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
5export 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
36auto handle = TestCase::create();
37const TestCase &instance = *handle;
38slint_testing::send_mouse_click(&instance, 95., 5.);
39assert(!instance.get_activated());
40slint_testing::send_mouse_click(&instance, 95., 5.);
41assert(instance.get_activated());
42```
43
44```rust
45let instance = TestCase::new().unwrap();
46slint_testing::send_mouse_click(&instance, 95., 5.);
47assert!(!instance.get_activated());
48slint_testing::send_mouse_click(&instance, 95., 5.);
49assert!(instance.get_activated());
50```
51
52```js
53var instance = new slint.TestCase();
54slintlib.private_api.send_mouse_click(instance, 95., 5.);
55assert(!instance.activated);
56slintlib.private_api.send_mouse_click(instance, 95., 5.);
57assert(instance.activated);
58```
59*/
60