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 | TestCase := Window { |
6 | VerticalLayout { |
7 | padding: 10px; |
8 | spacing: 27px; |
9 | Rectangle { |
10 | background: blue; |
11 | preferred-width: 25phx; |
12 | preferred-height: 500phx; |
13 | horizontal-stretch: 0; |
14 | vertical-stretch: 0; |
15 | } |
16 | Rectangle { |
17 | background: green; |
18 | // implicit: horizontal-stretch: 1 |
19 | } |
20 | } |
21 | |
22 | property w <=> root.preferred-width; |
23 | |
24 | property <bool> test: root.preferred_height == 500phx + 20px + 27px && root.preferred_width == 25phx + 20px; |
25 | } |
26 | |
27 | /* |
28 | |
29 | ```cpp |
30 | auto handle = TestCase::create(); |
31 | const TestCase &instance = *handle; |
32 | assert(instance.get_test()); |
33 | ``` |
34 | |
35 | |
36 | ```rust |
37 | let instance = TestCase::new().unwrap(); |
38 | assert!(instance.get_test()); |
39 | ``` |
40 | |
41 | ```js |
42 | var instance = new slint.TestCase(); |
43 | assert(instance.test); |
44 | ``` |
45 | |
46 | */ |
47 | } |
48 | |
49 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
50 | use i_slint_backend_testing as slint_testing; |
51 | slint_testing::init(); |
52 | let instance = TestCase::new().unwrap(); |
53 | assert!(instance.get_test()); |
54 | Ok(()) |
55 | } |