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 | // Test for issue #781 |
6 | |
7 | global Glop := { |
8 | property <int> r; |
9 | } |
10 | |
11 | SubSubCompo := Rectangle { |
12 | property <int> val; |
13 | TouchArea { |
14 | clicked => { Glop.r = val; } |
15 | } |
16 | } |
17 | SubCompo := SubSubCompo { } |
18 | |
19 | export TestCase := Window { |
20 | width: 300px; |
21 | height: 300px; |
22 | HorizontalLayout { |
23 | SubCompo { val: 88; } |
24 | SubCompo { val: 99; } |
25 | } |
26 | |
27 | property <int> result: Glop.r; |
28 | } |
29 | |
30 | /* |
31 | ```cpp |
32 | auto handle = TestCase::create(); |
33 | const TestCase &instance = *handle; |
34 | slint_testing::send_mouse_click(&instance, 295., 295.); |
35 | assert_eq(instance.get_result(), 99); |
36 | ``` |
37 | |
38 | ```rust |
39 | let instance = TestCase::new().unwrap(); |
40 | slint_testing::send_mouse_click(&instance, 295., 295.); |
41 | assert_eq!(instance.get_result(), 99); |
42 | ``` |
43 | |
44 | */ |
45 | } |
46 | |
47 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
48 | use i_slint_backend_testing as slint_testing; |
49 | slint_testing::init(); |
50 | let instance = TestCase::new().unwrap(); |
51 | slint_testing::send_mouse_click(&instance, x:295., y:295.); |
52 | assert_eq!(instance.get_result(), 99); |
53 | Ok(()) |
54 | } |