1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/crashes"# ] |
2 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
3 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
4 | |
5 | |
6 | export component TestCase inherits Rectangle { |
7 | |
8 | width: 300px; |
9 | height: 300px; |
10 | |
11 | property <bool> screen-state; |
12 | out property <bool> activated; |
13 | |
14 | if !screen-state: |
15 | vl := VerticalLayout { |
16 | if !screen-state: |
17 | ta1 := TouchArea { |
18 | clicked => { |
19 | screen-state = true; |
20 | } |
21 | |
22 | } |
23 | |
24 | // comment the line below and this page will work |
25 | re := Rectangle { height: 5px; } |
26 | } |
27 | |
28 | if screen-state : ta2 := TouchArea { |
29 | clicked => { activated = true; } |
30 | } |
31 | } |
32 | |
33 | |
34 | /* |
35 | |
36 | ```cpp |
37 | auto handle = TestCase::create(); |
38 | const TestCase &instance = *handle; |
39 | slint_testing::send_mouse_click(&instance, 95., 5.); |
40 | assert(!instance.get_activated()); |
41 | slint_testing::send_mouse_click(&instance, 95., 5.); |
42 | assert(instance.get_activated()); |
43 | ``` |
44 | |
45 | ```rust |
46 | let instance = TestCase::new().unwrap(); |
47 | slint_testing::send_mouse_click(&instance, 95., 5.); |
48 | assert!(!instance.get_activated()); |
49 | slint_testing::send_mouse_click(&instance, 95., 5.); |
50 | assert!(instance.get_activated()); |
51 | ``` |
52 | |
53 | ```js |
54 | var instance = new slint.TestCase(); |
55 | slintlib.private_api.send_mouse_click(instance, 95., 5.); |
56 | assert(!instance.activated); |
57 | slintlib.private_api.send_mouse_click(instance, 95., 5.); |
58 | assert(instance.activated); |
59 | ``` |
60 | */ |
61 | } |
62 | |
63 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
64 | use i_slint_backend_testing as slint_testing; |
65 | slint_testing::init(); |
66 | let instance = TestCase::new().unwrap(); |
67 | slint_testing::send_mouse_click(&instance, x:95., y:5.); |
68 | assert!(!instance.get_activated()); |
69 | slint_testing::send_mouse_click(&instance, x:95., y:5.); |
70 | assert!(instance.get_activated()); |
71 | Ok(()) |
72 | } |