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 | |
5 | // FIXME: currently the layout is broken, but at least it shouldn't panic |
6 | |
7 | import { ListView } from "std-widgets.slint" ; |
8 | |
9 | export struct Box { |
10 | visible: bool, |
11 | } |
12 | |
13 | export component TestCase inherits Window { |
14 | in property<[Box]> boxes: [{visible: false}, {visible: true}, {visible: false}, { visible: true }]; |
15 | preferred-width: 150px; |
16 | preferred-height: 150px; |
17 | out property<int> val; |
18 | ListView { |
19 | for box[i] in root.boxes: Rectangle { |
20 | height: 25px; |
21 | visible: box.visible; |
22 | Text { text: i; } |
23 | TouchArea { clicked => {val*=10;val+=i;}} |
24 | } |
25 | } |
26 | |
27 | } |
28 | |
29 | |
30 | /* |
31 | ```cpp |
32 | auto handle = TestCase::create(); |
33 | const TestCase &instance = *handle; |
34 | slint_testing::send_mouse_click(&instance, 5., 205.); |
35 | ``` |
36 | |
37 | ```rust |
38 | let instance = TestCase::new().unwrap(); |
39 | slint_testing::send_mouse_click(&instance, 5., 205.); |
40 | ``` |
41 | |
42 | ```js |
43 | var instance = new slint.TestCase(); |
44 | slintlib.private_api.send_mouse_click(instance, 5., 205.); |
45 | ``` |
46 | |
47 | */ |
48 | } |
49 | |
50 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
51 | use i_slint_backend_testing as slint_testing; |
52 | slint_testing::init(); |
53 | let instance = TestCase::new().unwrap(); |
54 | slint_testing::send_mouse_click(&instance, x:5., y:205.); |
55 | Ok(()) |
56 | } |