1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4// Regression test for a bug in which an alias to a model property was not
5// properly set because it was thought as constant
6
7MenuItem := Rectangle {
8 property <length> h <=> root.val;
9 height: val;
10 property <length> val;
11}
12
13export TestCase := Rectangle {
14 VerticalLayout {
15 for entry[idx] in [
16 { val: 12px },
17 ] : MenuItem {
18 h: entry.val;
19 }
20 Rectangle {}
21 }
22 property <bool> test: root.preferred_height == 12px;
23}
24
25/*
26```cpp
27auto handle = TestCase::create();
28const TestCase &instance = *handle;
29assert(instance.get_test());
30```
31
32```rust
33let instance = TestCase::new().unwrap();
34assert!(instance.get_test());
35```
36
37```js
38var instance = new slint.TestCase({});
39assert(instance.test);
40```
41*/
42