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
4Compo := Text {
5 property <int> prop_a: 10;
6 property <int> prop_b;
7 prop_b: 20;
8 text: "hello";
9}
10
11TestCase := Rectangle {
12 property <string> text: "ignore_me";
13 c := Compo {
14 prop_a: 1;
15 prop_b: 2;
16 text: "world";
17 }
18
19 property<int> prop_a: c.prop_a;
20 property<int> prop_b: c.prop_b;
21 property<string> prop_text: c.text;
22
23 property<bool> test: prop_a == 1 && prop_b == 2 && prop_text == "world";
24}
25
26/*
27```rust
28let instance = TestCase::new().unwrap();
29assert_eq!(instance.get_prop_a(), 1);
30assert_eq!(instance.get_prop_b(), 2);
31assert_eq!(instance.get_prop_text(), slint::SharedString::from("world"));
32```
33
34```cpp
35auto handle = TestCase::create();
36const TestCase &instance = *handle;
37assert_eq(instance.get_prop_a(), 1);
38assert_eq(instance.get_prop_b(), 2);
39assert_eq(instance.get_prop_text(), slint::SharedString("world"));
40```
41
42```js
43let instance = new slint.TestCase({});
44assert.equal(instance.prop_a, 1);
45assert.equal(instance.prop_b, 2);
46assert.equal(instance.prop_text, "world");
47```
48
49*/
50