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 | global Glob := { |
5 | property <int> a_alias <=> a; |
6 | property <int> a: 3; |
7 | property <int> b: a + 3; |
8 | |
9 | } |
10 | |
11 | TestCase := Rectangle { |
12 | callback set_a(int); |
13 | set_a(a) => { Glob.a_alias = a; } |
14 | property <int> value1: Glob.b; |
15 | property <bool> test: value1 == 3+3; |
16 | } |
17 | |
18 | /* |
19 | ```rust |
20 | let instance = TestCase::new().unwrap(); |
21 | assert_eq!(instance.get_value1(), 3+3); |
22 | instance.invoke_set_a(4); |
23 | assert_eq!(instance.get_value1(), 4+3); |
24 | ``` |
25 | |
26 | ```cpp |
27 | auto handle = TestCase::create(); |
28 | const TestCase &instance = *handle; |
29 | assert_eq(instance.get_value1(), 3+3); |
30 | instance.invoke_set_a(4); |
31 | assert_eq(instance.get_value1(), 4+3); |
32 | ``` |
33 | |
34 | ```js |
35 | let instance = new slint.TestCase({}); |
36 | assert.equal(instance.value1, 3+3); |
37 | instance.set_a(4); |
38 | assert.equal(instance.value1, 4+3); |
39 | ``` |
40 | |
41 | */ |
42 | |