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
5TestCase := Rectangle {
6 width: 100phx;
7 height: 100phx;
8 property <int> value;
9 callback clicked; // this callback shouldn't conflict with the other callback
10
11 TouchArea {
12 clicked => { value += 1; }
13 }
14}
15
16/*
17```cpp
18auto handle = TestCase::create();
19const TestCase &instance = *handle;
20slint_testing::send_mouse_click(&instance, 5., 5.);
21assert_eq(instance.get_value(), 1);
22```
23
24```rust
25let instance = TestCase::new().unwrap();
26slint_testing::send_mouse_click(&instance, 5., 5.);
27assert_eq!(instance.get_value(), 1);
28
29```
30
31```js
32var instance = new slint.TestCase();
33slintlib.private_api.send_mouse_click(instance, 5., 5.);
34assert.equal(instance.value, 1);
35```
36*/
37}
38
39#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
40 use i_slint_backend_testing as slint_testing;
41 slint_testing::init();
42 let instance = TestCase::new().unwrap();
43 slint_testing::send_mouse_click(&instance, x:5., y:5.);
44 assert_eq!(instance.get_value(), 1);
45
46 Ok(())
47}