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 | |
4 | |
5 | export component TestCase inherits Rectangle { |
6 | |
7 | width: 300px; |
8 | height: 300px; |
9 | |
10 | property <bool> screen-state; |
11 | out property <bool> activated; |
12 | |
13 | if !screen-state: |
14 | vl := VerticalLayout { |
15 | if !screen-state: |
16 | ta1 := TouchArea { |
17 | clicked => { |
18 | screen-state = true; |
19 | } |
20 | |
21 | } |
22 | |
23 | // comment the line below and this page will work |
24 | re := Rectangle { height: 5px; } |
25 | } |
26 | |
27 | if screen-state : ta2 := TouchArea { |
28 | clicked => { activated = true; } |
29 | } |
30 | } |
31 | |
32 | |
33 | /* |
34 | |
35 | ```cpp |
36 | auto handle = TestCase::create(); |
37 | const TestCase &instance = *handle; |
38 | slint_testing::send_mouse_click(&instance, 95., 5.); |
39 | assert(!instance.get_activated()); |
40 | slint_testing::send_mouse_click(&instance, 95., 5.); |
41 | assert(instance.get_activated()); |
42 | ``` |
43 | |
44 | ```rust |
45 | let instance = TestCase::new().unwrap(); |
46 | slint_testing::send_mouse_click(&instance, 95., 5.); |
47 | assert!(!instance.get_activated()); |
48 | slint_testing::send_mouse_click(&instance, 95., 5.); |
49 | assert!(instance.get_activated()); |
50 | ``` |
51 | |
52 | ```js |
53 | var instance = new slint.TestCase(); |
54 | slintlib.private_api.send_mouse_click(instance, 95., 5.); |
55 | assert(!instance.activated); |
56 | slintlib.private_api.send_mouse_click(instance, 95., 5.); |
57 | assert(instance.activated); |
58 | ``` |
59 | */ |
60 | |