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
8MenuItem := Rectangle {
9 property <length> h <=> root.val;
10 height: val;
11 property <length> val;
12}
13
14export 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
28auto handle = TestCase::create();
29const TestCase &instance = *handle;
30assert(instance.get_test());
31```
32
33```rust
34let instance = TestCase::new().unwrap();
35assert!(instance.get_test());
36```
37
38```js
39var instance = new slint.TestCase({});
40assert(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}