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
5global Numbers := {
6 property <int> three: 3;
7 property <int> ten: three * Numbers.three + 1;
8}
9
10export 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
17export 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
25TestCase := 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
36let instance = TestCase::new().unwrap();
37assert_eq!(instance.get_value1(), 3 + 13);
38instance.invoke_set_a(4);
39assert_eq!(instance.get_value1(), 4 + 13);
40```
41
42```cpp
43auto handle = TestCase::create();
44const TestCase &instance = *handle;
45assert_eq(instance.get_value1(), 3 + 13);
46instance.invoke_set_a(4);
47assert_eq(instance.get_value1(), 4 + 13);
48```
49
50```js
51let instance = new slint.TestCase({});
52assert.equal(instance.value1, 3 + 13);
53instance.set_a(4);
54assert.equal(instance.value1, 4 + 13);
55```
56
57*/
58