1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/bindings"# ] |
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 | // Regression test for a bug in which an alias to a model property was not |
6 | // properly set because it was thought as constant |
7 | |
8 | MenuItem := Rectangle { |
9 | property <length> h <=> root.val; |
10 | height: val; |
11 | property <length> val; |
12 | } |
13 | |
14 | export TestCase := Rectangle { |
15 | VerticalLayout { |
16 | for entry[idx] in [ |
17 | { val: 12px }, |
18 | ] : MenuItem { |
19 | h: entry.val; |
20 | } |
21 | Rectangle {} |
22 | } |
23 | property <bool> test: root.preferred_height == 12px; |
24 | } |
25 | |
26 | /* |
27 | ```cpp |
28 | auto handle = TestCase::create(); |
29 | const TestCase &instance = *handle; |
30 | assert(instance.get_test()); |
31 | ``` |
32 | |
33 | ```rust |
34 | let instance = TestCase::new().unwrap(); |
35 | assert!(instance.get_test()); |
36 | ``` |
37 | |
38 | ```js |
39 | var instance = new slint.TestCase({}); |
40 | assert(instance.test); |
41 | ``` |
42 | */ |
43 | } |
44 | |
45 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
46 | use i_slint_backend_testing as slint_testing; |
47 | slint_testing::init(); |
48 | let instance = TestCase::new().unwrap(); |
49 | assert!(instance.get_test()); |
50 | Ok(()) |
51 | } |