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
4O := Text {
5 property <int> val;
6 text: val;
7 property <int> a: val + 1;
8}
9
10TestCase := Window {
11 property <int> val: condition ? 2 : 4;
12 property <bool> condition : false;
13 HorizontalLayout {
14 o1 := O { val <=> root.val; }
15 o2 := O { val <=> root.val; }
16 o3 := O { val <=> root.val; }
17 o4 := O { val <=> root.val; }
18 o5 := O { val <=> root.val; }
19 }
20 property <int> checksum: 10000 * o1.a + 1000 * o2.a + 100 * o3.a + 10 * o4.a + 1 * o5.a;
21 property <bool> test: checksum == 55555;
22}
23
24
25/*
26
27```rust
28let instance = TestCase::new().unwrap();
29assert_eq!(instance.get_checksum(), 55555);
30instance.set_condition(true);
31assert_eq!(instance.get_checksum(), 33333);
32```
33
34
35
36```cpp
37auto handle = TestCase::create();
38const TestCase &instance = *handle;
39assert_eq(instance.get_checksum(), 55555);
40instance.set_condition(true);
41assert_eq(instance.get_checksum(), 33333);
42```
43
44
45```js
46let instance = new slint.TestCase({});
47assert.equal(instance.checksum, 55555);
48instance.condition = true;
49assert.equal(instance.checksum, 33333);
50```
51
52*/
53