1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/layout"#]
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
5export TestCase := Window {
6 width: 600px;
7 height: 300px;
8 property<[int]> xs: [200,100,300];
9 HorizontalLayout {
10 spacing: 10px;
11 padding: 0px;
12 alignment: center;
13 r1 := Rectangle { background: blue; width: 10px; }
14 VerticalLayout {
15 spacing: 10px;
16 padding: 0px;
17 alignment: start;
18 Rectangle {
19 height: 10px;
20 width: 200px;
21 background: red;
22 }
23 Rectangle {
24 height: 10px;
25 width: 100px;
26 background: red;
27 }
28 Rectangle {
29 height: 10px;
30 width: 300px;
31 background: red;
32 }
33 }
34 r2 := Rectangle { background: blue; width: 10px; }
35 }
36
37 property <bool> check_ok : r2.x == r1.x + 2*10px + 300px + 10px;
38
39 property <bool> test: check_ok;
40}
41
42/*
43
44```cpp
45auto handle = TestCase::create();
46const TestCase &instance = *handle;
47slint_testing::send_mouse_click(&instance, 1., 1.);
48assert(instance.get_check_ok());
49
50```
51
52
53```rust
54let instance = TestCase::new().unwrap();
55slint_testing::send_mouse_click(&instance, 1., 1.);
56assert!(instance.get_check_ok());
57```
58
59```js
60var instance = new slint.TestCase();
61slintlib.private_api.send_mouse_click(instance, 1., 1.);
62assert(instance.check_ok);
63```
64*/
65}
66
67#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
68 use i_slint_backend_testing as slint_testing;
69 slint_testing::init();
70 let instance = TestCase::new().unwrap();
71 slint_testing::send_mouse_click(&instance, x:1., y:1.);
72 assert!(instance.get_check_ok());
73 Ok(())
74}