1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4// This tests that constant property from global are properly initialized
5
6global Glob := {
7 property <int> a: 3;
8 property <int> b: a + 3;
9}
10
11global Glob2 := {
12 property <int> a: other;
13 property <int> other: 5;
14}
15
16TestCase := Rectangle {
17 r := Rectangle {
18 property <int> value1: Glob.b;
19 property <int> value2: true ? Glob2.a : 88;
20 }
21 property <bool> test: r.value1 + r.value2 == 3+3 +5;
22}
23
24/*
25```rust
26let instance = TestCase::new().unwrap();
27assert!(instance.get_test());
28```
29
30```cpp
31auto handle = TestCase::create();
32const TestCase &instance = *handle;
33assert(instance.get_test());
34```
35
36```js
37let instance = new slint.TestCase({});
38assert(instance.test);
39```
40
41*/
42