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 | |
6 | global Glob := { |
7 | property <int> a: 3; |
8 | property <int> b: a + 3; |
9 | } |
10 | |
11 | global Glob2 := { |
12 | property <int> a: other; |
13 | property <int> other: 5; |
14 | } |
15 | |
16 | TestCase := 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 |
26 | let instance = TestCase::new().unwrap(); |
27 | assert!(instance.get_test()); |
28 | ``` |
29 | |
30 | ```cpp |
31 | auto handle = TestCase::create(); |
32 | const TestCase &instance = *handle; |
33 | assert(instance.get_test()); |
34 | ``` |
35 | |
36 | ```js |
37 | let instance = new slint.TestCase({}); |
38 | assert(instance.test); |
39 | ``` |
40 | |
41 | */ |
42 | |