1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/callbacks"#]
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// Verify that the init callback is invoked in the correct order
6
7TestCase := Rectangle {
8 width: 300phx;
9 height: 300phx;
10
11 out property <bool> popup-created;
12
13 popup := PopupWindow {
14 init => {
15 root.popup-created = true;
16 }
17 }
18
19 TouchArea {
20 clicked => {
21 popup.show();
22 }
23 }
24}
25
26/*
27```rust
28let instance = TestCase::new().unwrap();
29
30slint_testing::send_mouse_click(&instance, 5., 5.);
31assert!(instance.get_popup_created());
32```
33
34```cpp
35auto handle = TestCase::create();
36const TestCase &instance = *handle;
37slint_testing::send_mouse_click(&instance, 5., 5.);
38assert(instance.get_popup_created());
39```
40
41
42```js
43var instance = new slint.TestCase({});
44slintlib.private_api.send_mouse_click(instance, 5., 5.);
45assert(instance.popup_created);
46```
47
48
49*/
50}
51
52#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
53 use i_slint_backend_testing as slint_testing;
54 slint_testing::init();
55 let instance = TestCase::new().unwrap();
56
57 slint_testing::send_mouse_click(&instance, x:5., y:5.);
58 assert!(instance.get_popup_created());
59 Ok(())
60}