1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4export component TestCase {
5 in-out property <int> touch1;
6 in-out property <int> touch2;
7 in-out property <int> touch3;
8 in-out property <int> touch_double1;
9 in-out property <int> touch_double2;
10 in-out property <int> touch_double3;
11
12 in-out property <string> pointer-event-test;
13
14 TouchArea {
15 x: 100phx;
16 y: 100phx;
17 width: 10phx;
18 height: 10phx;
19 clicked => { touch1+=1; }
20 double-clicked => { touch_double1+=1; }
21 mouse-cursor: move;
22 TouchArea {
23 y: 2phx;
24 height: 2phx;
25 x: 3phx;
26 width: 4phx;
27 clicked => { touch3+=1; }
28 double-clicked => { touch_double3+=1; }
29 mouse-cursor: default;
30 }
31 }
32 TouchArea {
33 x: 100phx;
34 y: 100phx;
35 width: 5phx;
36 height: 5phx;
37 mouse-cursor: pointer;
38 clicked => {
39 pointer-event-test += "click:";
40 touch2+=1;
41 }
42 double-clicked => {
43 pointer-event-test += "double_click:";
44 touch_double2+=1;
45 }
46 pointer-event(e) => {
47 if (e.kind == PointerEventKind.cancel) {
48 pointer-event-test += "cancel.";
49 } else if (e.kind == PointerEventKind.up) {
50 pointer-event-test += "up.";
51 } else if (e.kind == PointerEventKind.down) {
52 pointer-event-test += "down.";
53 } else if (e.kind == PointerEventKind.move) {
54 pointer-event-test += "move.";
55 } else {
56 pointer-event-test += "err.";
57 }
58 if (e.button == PointerEventButton.right) {
59 pointer-event-test += "right";
60 } else if (e.button == PointerEventButton.left) {
61 pointer-event-test += "left";
62 } else if (e.button == PointerEventButton.middle) {
63 pointer-event-test += "middle";
64 } else if (e.button == PointerEventButton.other) {
65 pointer-event-test += "other";
66 } else {
67 pointer-event-test += "???";
68 }
69 if (e.modifiers.control) {
70 pointer-event-test += "(ctrl)";
71 }
72 if (e.modifiers.shift) {
73 pointer-event-test += "(shift)";
74 }
75 if (e.modifiers.meta) {
76 pointer-event-test += "(meta)";
77 }
78 if (e.modifiers.alt) {
79 pointer-event-test += "(alt)";
80 }
81 pointer-event-test += ":";
82 }
83 }
84}
85
86/*
87```cpp
88using slint::PointerEventButton;
89
90auto handle = TestCase::create();
91const TestCase &instance = *handle;
92
93auto double_click = [&](float x, float y) {
94 slint_testing::send_mouse_click(&instance, x, y);
95 slint_testing::mock_elapsed_time(50);
96 slint_testing::send_mouse_click(&instance, x, y);
97};
98
99// does not click on anything
100slint_testing::send_mouse_click(&instance, 5., 5.);
101assert_eq(instance.get_touch1(), 0);
102assert_eq(instance.get_touch2(), 0);
103assert_eq(instance.get_touch3(), 0);
104assert_eq(instance.get_touch_double1(), 0);
105assert_eq(instance.get_touch_double2(), 0);
106assert_eq(instance.get_touch_double3(), 0);
107
108// click on second one
109slint_testing::mock_elapsed_time(1000);
110slint_testing::send_mouse_click(&instance, 101., 101.);
111assert_eq(instance.get_touch1(), 0);
112assert_eq(instance.get_touch2(), 1);
113assert_eq(instance.get_touch3(), 0);
114assert_eq(instance.get_touch_double1(), 0);
115assert_eq(instance.get_touch_double2(), 0);
116assert_eq(instance.get_touch_double3(), 0);
117
118// click on first one only
119slint_testing::mock_elapsed_time(1000);
120slint_testing::send_mouse_click(&instance, 108., 108.);
121assert_eq(instance.get_touch1(), 1);
122assert_eq(instance.get_touch2(), 1);
123assert_eq(instance.get_touch3(), 0);
124assert_eq(instance.get_touch_double1(), 0);
125assert_eq(instance.get_touch_double2(), 0);
126assert_eq(instance.get_touch_double3(), 0);
127
128// click on the third
129slint_testing::mock_elapsed_time(1000);
130slint_testing::send_mouse_click(&instance, 106., 103.);
131assert_eq(instance.get_touch1(), 1);
132assert_eq(instance.get_touch2(), 1);
133assert_eq(instance.get_touch3(), 1);
134assert_eq(instance.get_touch_double1(), 0);
135assert_eq(instance.get_touch_double2(), 0);
136assert_eq(instance.get_touch_double3(), 0);
137assert_eq(instance.get_pointer_event_test(), "move.other:down.left:click:up.left:move.other:");
138
139// does not double-click on anything
140slint_testing::mock_elapsed_time(1000);
141double_click(5., 5.);
142assert_eq(instance.get_touch1(), 1);
143assert_eq(instance.get_touch2(), 1);
144assert_eq(instance.get_touch3(), 1);
145assert_eq(instance.get_touch_double1(), 0);
146assert_eq(instance.get_touch_double2(), 0);
147assert_eq(instance.get_touch_double3(), 0);
148
149// double-click on second one
150slint_testing::mock_elapsed_time(1000);
151instance.set_pointer_event_test("");
152double_click(101., 101.);
153assert_eq(instance.get_touch1(), 1);
154assert_eq(instance.get_touch2(), 3);
155assert_eq(instance.get_touch3(), 1);
156assert_eq(instance.get_touch_double1(), 0);
157assert_eq(instance.get_touch_double2(), 1);
158assert_eq(instance.get_touch_double3(), 0);
159assert_eq(instance.get_pointer_event_test(), "move.other:down.left:click:up.left:move.other:move.other:down.left:click:double_click:up.left:move.other:");
160
161// double-click on first one only
162slint_testing::mock_elapsed_time(1000);
163double_click(108., 108.);
164assert_eq(instance.get_touch1(), 3);
165assert_eq(instance.get_touch2(), 3);
166assert_eq(instance.get_touch3(), 1);
167assert_eq(instance.get_touch_double1(), 1);
168assert_eq(instance.get_touch_double2(), 1);
169assert_eq(instance.get_touch_double3(), 0);
170
171// double-click on the third
172slint_testing::mock_elapsed_time(1000);
173double_click(106., 103.);
174assert_eq(instance.get_touch1(), 3);
175assert_eq(instance.get_touch2(), 3);
176assert_eq(instance.get_touch3(), 3);
177assert_eq(instance.get_touch_double1(), 1);
178assert_eq(instance.get_touch_double2(), 1);
179assert_eq(instance.get_touch_double3(), 1);
180
181// triple-click on second one
182slint_testing::mock_elapsed_time(1000);
183slint_testing::send_mouse_click(&instance, 106., 103.);
184slint_testing::send_mouse_click(&instance, 106., 103.);
185slint_testing::send_mouse_click(&instance, 106., 103.);
186assert_eq(instance.get_touch1(), 3);
187assert_eq(instance.get_touch2(), 3);
188assert_eq(instance.get_touch3(), 6);
189assert_eq(instance.get_touch_double1(), 1);
190assert_eq(instance.get_touch_double2(), 1);
191assert_eq(instance.get_touch_double3(), 2);
192
193// click quickly on two different mouse areas
194slint_testing::mock_elapsed_time(1000);
195instance.set_pointer_event_test("");
196slint_testing::mock_elapsed_time(1000);
197slint_testing::send_mouse_click(&instance, 101., 106.); // first
198slint_testing::mock_elapsed_time(20);
199slint_testing::send_mouse_click(&instance, 101., 104.); // second
200instance.window().dispatch_pointer_move_event(slint::LogicalPosition({ 1.0, 1.0 }));
201assert_eq(instance.get_touch1(), 4);
202assert_eq(instance.get_touch2(), 4);
203assert_eq(instance.get_touch3(), 6);
204assert_eq(instance.get_touch_double1(), 1);
205assert_eq(instance.get_touch_double2(), 1);
206assert_eq(instance.get_touch_double3(), 2);
207assert_eq(instance.get_pointer_event_test(), "move.other:down.left:click:up.left:move.other:");
208
209// click slowly on the same touch areas twice
210slint_testing::mock_elapsed_time(1000);
211instance.set_pointer_event_test("");
212slint_testing::mock_elapsed_time(1000);
213slint_testing::send_mouse_click(&instance, 101., 101.); // second
214slint_testing::mock_elapsed_time(1000);
215slint_testing::send_mouse_click(&instance, 101., 101.); // second
216instance.window().dispatch_pointer_move_event(slint::LogicalPosition({1.0, 1.0}));
217assert_eq(instance.get_touch1(), 4);
218assert_eq(instance.get_touch2(), 6);
219assert_eq(instance.get_touch3(), 6);
220assert_eq(instance.get_touch_double1(), 1);
221assert_eq(instance.get_touch_double2(), 1);
222assert_eq(instance.get_touch_double3(), 2);
223
224slint_testing::mock_elapsed_time(1000);
225slint_testing::send_mouse_click(&instance, 109., 101.); // first
226slint_testing::mock_elapsed_time(10);
227slint_testing::send_mouse_click(&instance, 101., 109.); // first
228assert_eq(instance.get_touch1(), 6);
229assert_eq(instance.get_touch2(), 6);
230assert_eq(instance.get_touch3(), 6);
231assert_eq(instance.get_touch_double1(), 1);
232assert_eq(instance.get_touch_double2(), 1);
233assert_eq(instance.get_touch_double3(), 2);
234
235
236slint_testing::mock_elapsed_time(1000);
237assert_eq(instance.get_touch1(), 6);
238assert_eq(instance.get_touch2(), 6);
239assert_eq(instance.get_touch3(), 6);
240assert_eq(instance.get_touch_double1(), 1);
241assert_eq(instance.get_touch_double2(), 1);
242assert_eq(instance.get_touch_double3(), 2);
243```
244
245```rust
246use slint::{platform::WindowEvent, LogicalPosition};
247use slint::private_unstable_api::re_exports::MouseCursor;
248
249let instance = TestCase::new().unwrap();
250
251let double_click = |x, y| {
252 slint_testing::send_mouse_click(&instance, x, y);
253 slint_testing::mock_elapsed_time(50);
254 slint_testing::send_mouse_click(&instance, x, y);
255};
256
257
258assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
259 "Unexpected mousecursor at start");
260
261// does not click on anything
262slint_testing::send_mouse_click(&instance, 5., 5.);
263slint_testing::mock_elapsed_time(1000);
264assert_eq!(instance.get_touch1(), 0, "Mis-click registered at touch1");
265assert_eq!(instance.get_touch2(), 0, "Mis-click registered at touch2");
266assert_eq!(instance.get_touch3(), 0, "Mis-click registered at touch3");
267assert_eq!(instance.get_touch_double1(), 0, "Mis-click registered at touch1 as double-click");
268assert_eq!(instance.get_touch_double2(), 0, "Mis-click registered at touch2 as double-click");
269assert_eq!(instance.get_touch_double3(), 0, "Mis-click registered at touch3 as double-click");
270assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
271 "Mis-click changed mouse cursor");
272
273// click on second one
274instance.set_pointer_event_test("".into());
275slint_testing::mock_elapsed_time(1000);
276slint_testing::send_mouse_click(&instance, 101., 101.);
277assert_eq!(instance.get_touch1(), 0, "Click on 2 registered at touch1");
278assert_eq!(instance.get_touch2(), 1, "Click on 2 did not register at touch2");
279assert_eq!(instance.get_touch3(), 0, "Click on 2 registered at touch3");
280assert_eq!(instance.get_touch_double1(), 0, "Click on 2 registered at touch1 as double-click");
281assert_eq!(instance.get_touch_double2(), 0, "Click on 2 registered at touch2 as double-click");
282assert_eq!(instance.get_touch_double3(), 0, "Click on 2 registered at touch3 as double-click");
283assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Pointer,
284 "Click on 1 did not change mouse pointer");
285
286// click on first one only
287slint_testing::mock_elapsed_time(1000);
288slint_testing::send_mouse_click(&instance, 108., 108.);
289assert_eq!(instance.get_touch1(), 1, "Click on 1 did not register at touch1");
290assert_eq!(instance.get_touch2(), 1, "Click on 1 registered at touch2");
291assert_eq!(instance.get_touch3(), 0, "Click on 1 registered at touch3");
292assert_eq!(instance.get_touch_double1(), 0, "Click on 1 registered at touch1 as double-click");
293assert_eq!(instance.get_touch_double2(), 0, "Click on 1 registered at touch2 as double-click");
294assert_eq!(instance.get_touch_double3(), 0, "Click on 1 registered at touch3 as double-click");
295assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Move,
296 "Click on 2 did not change mouse pointer");
297
298// click on the third
299slint_testing::mock_elapsed_time(1000);
300slint_testing::send_mouse_click(&instance, 106., 103.);
301assert_eq!(instance.get_touch1(), 1, "Click on 3 registered at touch1");
302assert_eq!(instance.get_touch2(), 1, "Click on 3 registered at touch2");
303assert_eq!(instance.get_touch3(), 1, "Click on 3 did not register at touch3");
304assert_eq!(instance.get_touch_double1(), 0, "Click on 3 registered at touch1 as double-click");
305assert_eq!(instance.get_touch_double2(), 0, "Click on 3 registered at touch2 as double-click");
306assert_eq!(instance.get_touch_double3(), 0, "Click on 3 registered at touch3 as double-click");
307assert_eq!(instance.get_pointer_event_test().as_str(), "move.other:down.left:click:up.left:move.other:",
308 "Click on 3 produced an unexpected sequence of events");
309assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
310 "Click on 3 did not change mouse pointer");
311
312// does not double-click on anything
313slint_testing::mock_elapsed_time(1000);
314double_click(5., 5.);
315assert_eq!(instance.get_touch1(), 1, "Mis-double-click registered at touch1");
316assert_eq!(instance.get_touch2(), 1, "Mis-double-click registered at touch2");
317assert_eq!(instance.get_touch3(), 1, "Mis-double-click registered at touch3");
318assert_eq!(instance.get_touch_double1(), 0, "Mis-double-click registered at touch1 as double-click");
319assert_eq!(instance.get_touch_double2(), 0, "Mis-double-click registered at touch2 as double-click");
320assert_eq!(instance.get_touch_double3(), 0, "Mis-double-click registered at touch3 as double-click");
321assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
322 "Mis-double-click on 3 did not change mouse pointer");
323
324// double-click on second one
325slint_testing::mock_elapsed_time(1000);
326instance.set_pointer_event_test("".into());
327double_click(101., 101.);
328assert_eq!(instance.get_touch1(), 1, "Double-click on 2 registered at touch1");
329assert_eq!(instance.get_touch2(), 3, "Double-click on 2 did not registered at touch2");
330assert_eq!(instance.get_touch3(), 1, "Double-click on 2 registered at touch3");
331assert_eq!(instance.get_touch_double1(), 0, "Double-click on 2 registered at touch1 as double-click");
332assert_eq!(instance.get_touch_double2(), 1, "Double-click on 2 did not register at touch1 as double-click");
333assert_eq!(instance.get_touch_double3(), 0, "Double-click on 2 registered at touch1 as double-click");
334assert_eq!(instance.get_pointer_event_test().as_str(), "move.other:down.left:click:up.left:move.other:move.other:down.left:click:double_click:up.left:move.other:",
335 "Double-click on 2 produced an unexpected sequence of events");
336assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Pointer,
337 "Double-click on 2 did not change mouse pointer");
338
339// double-click on first one only
340slint_testing::mock_elapsed_time(1000);
341double_click(108., 108.);
342assert_eq!(instance.get_touch1(), 3, "Double-click on 1 did not registered at touch1");
343assert_eq!(instance.get_touch2(), 3, "Double-click on 1 registered at touch2");
344assert_eq!(instance.get_touch3(), 1, "Double-click on 1 registered at touch3");
345assert_eq!(instance.get_touch_double1(), 1, "Double-click on 1 did not register at touch1 as double-click");
346assert_eq!(instance.get_touch_double2(), 1, "Double-click on 1 registered at touch2 as double-click");
347assert_eq!(instance.get_touch_double3(), 0, "Double-click on 1 registered at touch3 as double-click");
348assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Move,
349 "Double-click on 1 did not change mouse pointer");
350
351// double-click on the third
352slint_testing::mock_elapsed_time(1000);
353double_click(106., 103.);
354assert_eq!(instance.get_touch1(), 3, "Double-click on 3 registered at touch1");
355assert_eq!(instance.get_touch2(), 3, "Double-click on 3 registered at touch2");
356assert_eq!(instance.get_touch3(), 3, "Double-click on 3 did not registered at touch3");
357assert_eq!(instance.get_touch_double1(), 1, "Double-click on 3 registered at touch1 as double-click");
358assert_eq!(instance.get_touch_double2(), 1, "Double-click on 3 registered at touch2 as double-click");
359assert_eq!(instance.get_touch_double3(), 1, "Double-click on 3 did not register at touch3 as double-click");
360assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
361 "Double-click on 3 did not change mouse pointer");
362
363// triple-click on the third (treated as a double click, followed by a single click)
364slint_testing::mock_elapsed_time(1000);
365slint_testing::send_mouse_click(&instance, 106.0, 103.0);
366assert_eq!(instance.get_touch1(), 3, "Triple-click (1st click) on 3 registered at touch1");
367assert_eq!(instance.get_touch2(), 3, "Triple-click (1st click) on 3 registered at touch2");
368assert_eq!(instance.get_touch3(), 4, "Triple-click (1st click) on 3 did not register at touch3");
369slint_testing::send_mouse_click(&instance, 106.0, 103.0);
370assert_eq!(instance.get_touch1(), 3, "Triple-click (2st click) on 3 registered at touch1");
371assert_eq!(instance.get_touch2(), 3, "Triple-click (2st click) on 3 registered at touch2");
372assert_eq!(instance.get_touch3(), 5, "Triple-click (2st click) on 3 did not register at touch3");
373slint_testing::send_mouse_click(&instance, 106.0, 103.0);
374assert_eq!(instance.get_touch1(), 3, "Triple-click on 3 registered at touch1");
375assert_eq!(instance.get_touch2(), 3, "Triple-click on 3 registered at touch1");
376assert_eq!(instance.get_touch3(), 6, "Triple-click on 3 registered at touch1");
377assert_eq!(instance.get_touch_double1(), 1, "Triple-click on 3 registered at touch1");
378assert_eq!(instance.get_touch_double2(), 1, "Triple-click on 3 registered at touch2");
379assert_eq!(instance.get_touch_double3(), 2, "Triple-click on 3 did not register at touch3 as double-click");
380assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
381 "Triple-click on 3 did not change mouse pointer");
382
383// click really quickly on two different mouse areas
384slint_testing::mock_elapsed_time(1000);
385instance.set_pointer_event_test("".into());
386slint_testing::mock_elapsed_time(1000);
387slint_testing::send_mouse_click(&instance, 101., 106.); // first
388slint_testing::mock_elapsed_time(20);
389slint_testing::send_mouse_click(&instance, 101., 104.); // second
390instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(1.0, 1.0) });
391assert_eq!(instance.get_touch1(), 4, "click on different touch areas did not register on touch1");
392assert_eq!(instance.get_touch2(), 4, "click on different touch areas did not register on touch2");
393assert_eq!(instance.get_touch3(), 6, "click on different touch areas registered at touch3");
394assert_eq!(instance.get_touch_double1(), 1, "click on different touch areas registered on touch1 as double-click");
395assert_eq!(instance.get_touch_double2(), 1, "click on different touch areas registered on touch2 as double-click");
396assert_eq!(instance.get_touch_double3(), 2, "click on different touch areas registered on touch3 as double-click");
397assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
398 "click on different touch areas changed mouse pointer");
399assert_eq!(instance.get_pointer_event_test().as_str(), "move.other:down.left:click:up.left:move.other:",
400 "click on different touch areas produced an unexpected sequence of events");
401
402// click slowly on the same touch areas twice
403slint_testing::mock_elapsed_time(1000);
404instance.set_pointer_event_test("".into());
405slint_testing::send_mouse_click(&instance, 101., 101.); // second
406slint_testing::mock_elapsed_time(1000);
407slint_testing::send_mouse_click(&instance, 101., 101.); // second
408instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(1.0, 1.0) });
409
410assert_eq!(instance.get_touch1(), 4, "Slow double click did not register on touch1");
411assert_eq!(instance.get_touch2(), 6, "Slow double click did not register on touch2");
412assert_eq!(instance.get_touch3(), 6, "Slow double click did not register on touch3");
413assert_eq!(instance.get_touch_double1(), 1, "Slow double click registered on touch1 as double-click");
414assert_eq!(instance.get_touch_double2(), 1, "Slow double click registered on touch2 as double-click");
415assert_eq!(instance.get_touch_double3(), 2, "Slow double click registered on touch3 as double-click");
416assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default,
417 "click on different touch areas changed mouse pointer");
418assert_eq!(instance.get_pointer_event_test().as_str(), "move.other:down.left:click:up.left:move.other:move.other:down.left:click:up.left:move.other:",
419 "click on different touch areas produced an unexpected sequence of events");
420
421
422// Click on the same mouse area but using a distance which is more than the threshold
423slint_testing::mock_elapsed_time(1000);
424slint_testing::send_mouse_click(&instance, 109., 101.); // first
425slint_testing::mock_elapsed_time(10);
426slint_testing::send_mouse_click(&instance, 101., 109.); // first
427assert_eq!(instance.get_touch1(), 6, "long distance click 1");
428assert_eq!(instance.get_touch2(), 6, "long distance click 2");
429assert_eq!(instance.get_touch3(), 6, "long distance click 3");
430assert_eq!(instance.get_touch_double1(), 1, "long distance click as double click 1");
431assert_eq!(instance.get_touch_double2(), 1, "long distance click as double click 2");
432assert_eq!(instance.get_touch_double3(), 2, "long distance click as double click 3");
433
434
435slint_testing::mock_elapsed_time(1000);
436assert_eq!(instance.get_touch1(), 6, "Cool down changed touch1");
437assert_eq!(instance.get_touch2(), 6, "Cool down changed touch2");
438assert_eq!(instance.get_touch3(), 6, "Cool down changed touch3");
439assert_eq!(instance.get_touch_double1(), 1, "Cool down changed touch-double1");
440assert_eq!(instance.get_touch_double2(), 1, "Cool down changed touch-double2");
441assert_eq!(instance.get_touch_double3(), 2, "Cool down changed touch-double3");
442```
443
444```js
445var instance = new slint.TestCase();
446
447function double_click(x, y) {
448 slintlib.private_api.send_mouse_click(instance, x, y);
449 slintlib.private_api.mock_elapsed_time(50);
450 slintlib.private_api.send_mouse_click(instance, x, y);
451}
452
453// // // Disable the test as the time handling is currently broken in JS tests!
454
455// // does not click on anything
456// slintlib.private_api.send_mouse_click(instance, 5., 5.);
457// assert.equal(instance.touch1, 0);
458// assert.equal(instance.touch2, 0);
459// assert.equal(instance.touch3, 0);
460// assert.equal(instance.touch_double1, 0);
461// assert.equal(instance.touch_double2, 0);
462// assert.equal(instance.touch_double3, 0);
463
464// // click on second one
465// slintlib.private_api.mock_elapsed_time(1000);
466// slintlib.private_api.send_mouse_click(instance, 101., 101.);
467// assert.equal(instance.touch1, 0);
468// assert.equal(instance.touch2, 1);
469// assert.equal(instance.touch3, 0);
470// assert.equal(instance.touch_double1, 0);
471// assert.equal(instance.touch_double2, 0);
472// assert.equal(instance.touch_double3, 0);
473
474// // click on first one only
475// slintlib.private_api.mock_elapsed_time(2000);
476// slintlib.private_api.send_mouse_click(instance, 108., 108.);
477// assert.equal(instance.touch1, 1);
478// assert.equal(instance.touch2, 1);
479// assert.equal(instance.touch3, 0);
480// assert.equal(instance.touch_double1, 0);
481// assert.equal(instance.touch_double2, 0);
482// assert.equal(instance.touch_double3, 0);
483
484// // click on the third
485// slintlib.private_api.mock_elapsed_time(1000);
486// slintlib.private_api.send_mouse_click(instance, 106., 103.);
487// assert.equal(instance.touch1, 1);
488// assert.equal(instance.touch2, 1);
489// assert.equal(instance.touch3, 1);
490// assert.equal(instance.touch_double1, 0);
491// assert.equal(instance.touch_double2, 0);
492// assert.equal(instance.touch_double3, 0);
493
494// assert.equal(instance.pointer_event_test, "move.other:down.left:click:up.left:move.other:");
495
496// // does not double-click on anything
497// slintlib.private_api.mock_elapsed_time(1000);
498// double_click(5., 5.);
499// assert.equal(instance.touch1, 1);
500// assert.equal(instance.touch2, 1);
501// assert.equal(instance.touch3, 1);
502// assert.equal(instance.touch_double1, 0);
503// assert.equal(instance.touch_double2, 0);
504// assert.equal(instance.touch_double3, 0);
505
506// // double-click on second one
507// slintlib.private_api.mock_elapsed_time(1000);
508// instance.pointer_event_test = "";
509// double_click(101., 101.);
510// assert.equal(instance.touch1, 1);
511// assert.equal(instance.touch2, 3);
512// assert.equal(instance.touch3, 1);
513// assert.equal(instance.touch_double1, 0);
514// assert.equal(instance.touch_double2, 1);
515// assert.equal(instance.touch_double3, 0);
516// assert.equal(instance.pointer_event_test, "move.other:down.left:click:up.left:move.other:move.other:down.left:click:double_click:up.left:move.other:");
517
518// // double-click on first one only
519// slintlib.private_api.mock_elapsed_time(1000);
520// double_click(108., 108.);
521// assert.equal(instance.touch1, 3);
522// assert.equal(instance.touch2, 3);
523// assert.equal(instance.touch3, 1);
524// assert.equal(instance.touch_double1, 1);
525// assert.equal(instance.touch_double2, 1);
526// assert.equal(instance.touch_double3, 0);
527
528// // double-click on third one only
529// slintlib.private_api.mock_elapsed_time(1000);
530// double_click(106., 103.);
531// assert.equal(instance.touch1, 3);
532// assert.equal(instance.touch2, 3);
533// assert.equal(instance.touch3, 3);
534// assert.equal(instance.touch_double1, 1);
535// assert.equal(instance.touch_double2, 1);
536// assert.equal(instance.touch_double3, 1);
537
538// // triple-click on the third
539// slintlib.private_api.mock_elapsed_time(1000);
540// slintlib.private_api.send_mouse_click(instance, 106., 103.);
541// assert.equal(instance.touch3, 4);
542// assert.equal(instance.touch_double3, 1);
543// slintlib.private_api.send_mouse_click(instance, 106., 103.);
544// assert.equal(instance.touch3, 5);
545// assert.equal(instance.touch_double3, 2);
546// slintlib.private_api.send_mouse_click(instance, 106., 103.);
547// assert.equal(instance.touch1, 3);
548// assert.equal(instance.touch2, 3);
549// assert.equal(instance.touch3, 6);
550// assert.equal(instance.touch_double1, 1);
551// assert.equal(instance.touch_double2, 1);
552// assert.equal(instance.touch_double3, 2);
553
554// // click really quickly on two different mouse areas
555// slintlib.private_api.mock_elapsed_time(1000);
556// instance.pointer_event_test = "";
557// slintlib.private_api.send_mouse_click(instance, 108., 108.);
558// slintlib.private_api.mock_elapsed_time(20);
559// slintlib.private_api.send_mouse_click(instance, 101., 101.);
560// assert.equal(instance.touch1, 4);
561// assert.equal(instance.touch2, 4);
562// assert.equal(instance.touch3, 6);
563// assert.equal(instance.touch_double1, 1);
564// assert.equal(instance.touch_double2, 1);
565// assert.equal(instance.touch_double3, 2);
566// assert.equal(instance.pointer_event_test, "move.other:down.left:click:up.left:move.other:");
567
568// // click slowly on the same touch areas twice
569// slintlib.private_api.mock_elapsed_time(1000);
570// instance.pointer_event_test = "";
571// slintlib.private_api.send_mouse_click(instance, 101., 101.);
572// slintlib.private_api.mock_elapsed_time(1000);
573// slintlib.private_api.send_mouse_click(instance, 101., 101.);
574// assert.equal(instance.touch1, 4);
575// assert.equal(instance.touch2, 6);
576// assert.equal(instance.touch3, 6);
577// assert.equal(instance.touch_double1, 1);
578// assert.equal(instance.touch_double2, 1);
579// assert.equal(instance.touch_double3, 2);
580// assert.equal(instance.pointer_event_test, "move.other:down.left:click:up.left:move.other:move.other:down.left:click:up.left:move.other:");
581
582// slintlib.private_api.mock_elapsed_time(1000);
583// assert.equal(instance.touch1, 4);
584// assert.equal(instance.touch2, 6);
585// assert.equal(instance.touch3, 6);
586// assert.equal(instance.touch_double1, 1);
587// assert.equal(instance.touch_double2, 1);
588// assert.equal(instance.touch_double3, 2);
589```
590*/
591