about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-11-12 16:26:51 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-11-12 16:31:12 -0800
commit7057ac74eceac82a10ae01d6fe7cab0944184c73 (patch)
tree50515b45c4ff55152e055707f8b31146a6a67776
parentd90dff328697f64677d49e7022fbc08de8d4d2a1 (diff)
downloadtext.love-7057ac74eceac82a10ae01d6fe7cab0944184c73.tar.gz
check for 'error' mode in a few more places
In particular, I want to be able to switch to 'error' mode rather than
throw a real error() on test failures, because that's a little more
responsive and might be recoverable. (On some Android devices the font
is slightly different, and tests fail as a result.)
-rw-r--r--main.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/main.lua b/main.lua
index ecc261e..8272dfd 100644
--- a/main.lua
+++ b/main.lua
@@ -66,6 +66,7 @@ function App.load()
         load_file_from_source_or_save_directory('colorize.lua')
       load_file_from_source_or_save_directory('source_text_tests.lua')
     load_file_from_source_or_save_directory('source_tests.lua')
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -93,6 +94,7 @@ function App.initialize_globals()
     run.initialize_globals()
   elseif Current_app == 'source' then
     source.initialize_globals()
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -113,6 +115,7 @@ function App.initialize(arg)
     run.initialize(arg)
   elseif Current_app == 'source' then
     source.initialize(arg)
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -123,6 +126,7 @@ function App.resize(w,h)
     if run.resize then run.resize(w,h) end
   elseif Current_app == 'source' then
     if source.resize then source.resize(w,h) end
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -134,6 +138,7 @@ function App.filedropped(file)
     if run.file_drop then run.file_drop(file) end
   elseif Current_app == 'source' then
     if source.file_drop then source.file_drop(file) end
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -147,21 +152,22 @@ function App.focus(in_focus)
     if run.focus then run.focus(in_focus) end
   elseif Current_app == 'source' then
     if source.focus then source.focus(in_focus) end
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
 end
 
 function App.draw()
-  if Current_app == 'error' then
+  if Current_app == 'run' then
+    run.draw()
+  elseif Current_app == 'source' then
+    source.draw()
+  elseif Current_app == 'error' then
     love.graphics.setColor(0,0,1)
     love.graphics.rectangle('fill', 0,0, App.screen.width, App.screen.height)
     love.graphics.setColor(1,1,1)
     love.graphics.printf(Error_message, 40,40, 600)
-  elseif Current_app == 'run' then
-    run.draw()
-  elseif Current_app == 'source' then
-    source.draw()
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -178,6 +184,7 @@ function App.update(dt)
     run.update(dt)
   elseif Current_app == 'source' then
     source.update(dt)
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
@@ -209,6 +216,7 @@ function App.keychord_press(chord, key)
       if source.quit then source.quit() end
       Current_app = 'run'
       Error_message = nil
+    elseif Current_app == 'error' then
     else
       assert(false, 'unknown app "'..Current_app..'"')
     end
@@ -224,6 +232,7 @@ function App.keychord_press(chord, key)
     if run.keychord_press then run.keychord_press(chord, key) end
   elseif Current_app == 'source' then
     if source.keychord_press then source.keychord_press(chord, key) end
+  elseif Current_app == 'error' then
   else
     assert(false, 'unknown app "'..Current_app..'"')
   end
itter hut <hut@lavabit.com> 2010-12-22 03:37:42 +0100 We are not authorized to disclose the commit message' href='/akspecs/ranger/commit/CHANGELOG?h=v1.9.0b3&id=ef2b1e374359aec59199c7e8d9334fe2aefed153'>ef2b1e37 ^
2ed2d4f7 ^




b7b8f3a0 ^




c8f870cb ^



ef2b1e37 ^















81f5ac9e ^
efd7c0c1 ^






cbcd3325 ^






81f5ac9e ^
cbcd3325 ^
d3bcb234 ^

cbcd3325 ^
81f5ac9e ^











cbcd3325 ^
90018274 ^




cbcd3325 ^
95e021ae ^

c928a9eb ^
95e021ae ^
cbcd3325 ^
95e021ae ^















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222