| 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 | |
| 5 | global Numbers := { |
| 6 | property <int> three: 3; |
| 7 | property <int> ten: three * Numbers.three + 1; |
| 8 | } |
| 9 | |
| 10 | export global A := { |
| 11 | property <int> a_alias <=> a; |
| 12 | property <int> a: 3; |
| 13 | property <int> b: a + three; |
| 14 | property <int> three: Numbers.three; |
| 15 | } |
| 16 | |
| 17 | export global B := { |
| 18 | // property <int> a_alias <=> A.a_alias; |
| 19 | property <int> c: { |
| 20 | debug(A.b, Numbers.ten); |
| 21 | A.b + Numbers.ten; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | TestCase := Rectangle { |
| 26 | callback set_a(int); |
| 27 | set_a(a) => { |
| 28 | A.a_alias = a; |
| 29 | } |
| 30 | property <int> value1: B.c; |
| 31 | property <bool> test: value1 == 3 + 13; |
| 32 | } |
| 33 | |
| 34 | /* |
| 35 | ```rust |
| 36 | let instance = TestCase::new().unwrap(); |
| 37 | assert_eq!(instance.get_value1(), 3 + 13); |
| 38 | instance.invoke_set_a(4); |
| 39 | assert_eq!(instance.get_value1(), 4 + 13); |
| 40 | ``` |
| 41 | |
| 42 | ```cpp |
| 43 | auto handle = TestCase::create(); |
| 44 | const TestCase &instance = *handle; |
| 45 | assert_eq(instance.get_value1(), 3 + 13); |
| 46 | instance.invoke_set_a(4); |
| 47 | assert_eq(instance.get_value1(), 4 + 13); |
| 48 | ``` |
| 49 | |
| 50 | ```js |
| 51 | let instance = new slint.TestCase({}); |
| 52 | assert.equal(instance.value1, 3 + 13); |
| 53 | instance.set_a(4); |
| 54 | assert.equal(instance.value1, 4 + 13); |
| 55 | ``` |
| 56 | |
| 57 | */ |
| 58 | |