From 173d3a3de0a99769e0378436c4375f8bd39aef5c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 9 Jun 2022 15:09:32 -0700 Subject: test both ways of selecting text with mouse --- text_tests.lua | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/text_tests.lua b/text_tests.lua index 4a6203f..097f487 100644 --- a/text_tests.lua +++ b/text_tests.lua @@ -189,6 +189,27 @@ function test_select_text_using_mouse() Selection1 = {} App.draw() -- populate line.y for each line in Lines local screen_left_margin = 25 -- pixels + -- press and hold on first location + App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1') + -- drag and release somewhere else + App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1') + check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line') + check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos') + check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse/selection:line') + check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos') +end + +function test_select_text_using_mouse_and_shift() + io.write('\ntest_select_text_using_mouse_and_shift') + App.screen.init{width=50, height=60} + Lines = load_array{'abc', 'def', 'xyz'} + Line_width = App.screen.width + Cursor1 = {line=1, pos=1} + Screen_top1 = {line=1, pos=1} + Screen_bottom1 = {} + Selection1 = {} + App.draw() -- populate line.y for each line in Lines + local screen_left_margin = 25 -- pixels -- click on first location App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1') App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1') @@ -197,10 +218,10 @@ function test_select_text_using_mouse() App.run_after_mousepress(screen_left_margin+20,Margin_top+5, '1') App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1') App.keyrelease('lshift') - check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line') - check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos') - check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse/selection:line') - check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos') + check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse_and_shift/cursor:line') + check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse_and_shift/cursor:pos') + check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse_and_shift/selection:line') + check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse_and_shift/selection:pos') end function test_pagedown() -- cgit 1.4.1-2-gfad0 a href='/akkartik/mu/tree/html?h=main&id=f03c9c05494997d4d1d64594fd357170f45d2da2'>html/028call_reply.cc.html
blob: cea9db3e66058b1ec57297c3d51ea95143fe6c81 (plain) (blame)
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