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