1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/children"# ] |
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 | Container := Rectangle { |
6 | GridLayout { |
7 | padding: 0phx; |
8 | spacing: 0phx; |
9 | Row { |
10 | Rectangle { |
11 | background: green; |
12 | } |
13 | @children |
14 | } |
15 | } |
16 | } |
17 | |
18 | MegaContainer := Rectangle { |
19 | Container { |
20 | @children |
21 | width: parent.width; |
22 | height: parent.height; |
23 | } |
24 | } |
25 | |
26 | TestCase := MegaContainer { |
27 | width: 300phx; |
28 | height: 200phx; |
29 | |
30 | rect1 := Rectangle { |
31 | background: black; |
32 | } |
33 | |
34 | |
35 | property <bool> rect1_pos_ok: rect1.x == 150phx; |
36 | } |
37 | /* |
38 | ```cpp |
39 | auto handle = TestCase::create(); |
40 | const TestCase &instance = *handle; |
41 | assert(instance.get_rect1_pos_ok()); |
42 | ``` |
43 | |
44 | |
45 | ```rust |
46 | let instance = TestCase::new().unwrap(); |
47 | assert!(instance.get_rect1_pos_ok()); |
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 | assert!(instance.get_rect1_pos_ok()); |
57 | Ok(()) |
58 | } |