1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/issues"#]
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
6TestCase := Rectangle {
7 height: 100phx;
8 width: 100phx;
9 property <int> clicked;
10 property <bool> condition;
11
12 if true : TouchArea {
13 visible: condition;
14 clicked => { root.clicked += 1; }
15 }
16
17 HorizontalLayout {
18 for xx in [10] : TouchArea {
19 visible: false;
20 clicked => { root.clicked += xx; }
21 }
22 }
23}
24
25/*
26```cpp
27auto handle = TestCase::create();
28const TestCase &instance = *handle;
29
30slint_testing::send_mouse_click(&instance, 37., 27.);
31assert_eq(instance.get_clicked(), 0);
32
33instance.set_condition(true);
34slint_testing::send_mouse_click(&instance, 37., 27.);
35assert_eq(instance.get_clicked(), 1);
36
37```
38
39
40```rust
41let instance = TestCase::new().unwrap();
42slint_testing::send_mouse_click(&instance, 37., 27.);
43assert_eq!(instance.get_clicked(), 0);
44
45instance.set_condition(true);
46slint_testing::send_mouse_click(&instance, 37., 27.);
47assert_eq!(instance.get_clicked(), 1);
48
49
50```
51
52*/
53}
54
55#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
56 use i_slint_backend_testing as slint_testing;
57 slint_testing::init();
58 let instance = TestCase::new().unwrap();
59 slint_testing::send_mouse_click(&instance, x:37., y:27.);
60 assert_eq!(instance.get_clicked(), 0);
61
62 instance.set_condition(true);
63 slint_testing::send_mouse_click(&instance, x:37., y:27.);
64 assert_eq!(instance.get_clicked(), 1);
65
66
67 Ok(())
68}