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
4component IndirectChange {
5 in property <[int]> mod;
6 property <[int]> private: mod;
7
8 init => {
9 private[0] += 1;
10 }
11}
12
13export component TestCase {
14
15 property <[int]> m1: [5];
16 property <[int]> m2: [8];
17 property <[int]> indirect: m2;
18
19 public function up() {
20 indirect[0] += 10;
21 }
22
23 callback up2();
24 up2 => {up()}
25
26 IndirectChange { mod: m1; }
27
28 out property <int> t1: m1[0];
29 out property <int> t2: m2[0];
30
31 out property <bool> test: t1 == 5+1 && t2 == 8;
32}
33
34/*
35```cpp
36auto handle = TestCase::create();
37const TestCase &instance = *handle;
38assert_eq(instance.get_t1(), 6);
39assert(instance.get_test());
40instance.invoke_up();
41assert_eq(instance.get_t2(), 18);
42
43```
44
45
46```rust
47let instance = TestCase::new().unwrap();
48assert_eq!(instance.get_t1(), 6);
49assert!(instance.get_test());
50instance.invoke_up();
51assert_eq!(instance.get_t2(), 18);
52```
53
54```js
55var instance = new slint.TestCase({});
56assert.equal(instance.t1, 6);
57assert(instance.test);
58instance.up2();
59assert.equal(instance.t2, 18);
60```
61*/
62