| 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 | Compo := Text { |
| 5 | property <int> prop_a: 10; |
| 6 | property <int> prop_b; |
| 7 | prop_b: 20; |
| 8 | text: "hello" ; |
| 9 | } |
| 10 | |
| 11 | TestCase := 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 |
| 28 | let instance = TestCase::new().unwrap(); |
| 29 | assert_eq!(instance.get_prop_a(), 1); |
| 30 | assert_eq!(instance.get_prop_b(), 2); |
| 31 | assert_eq!(instance.get_prop_text(), slint::SharedString::from("world")); |
| 32 | ``` |
| 33 | |
| 34 | ```cpp |
| 35 | auto handle = TestCase::create(); |
| 36 | const TestCase &instance = *handle; |
| 37 | assert_eq(instance.get_prop_a(), 1); |
| 38 | assert_eq(instance.get_prop_b(), 2); |
| 39 | assert_eq(instance.get_prop_text(), slint::SharedString("world")); |
| 40 | ``` |
| 41 | |
| 42 | ```js |
| 43 | let instance = new slint.TestCase({}); |
| 44 | assert.equal(instance.prop_a, 1); |
| 45 | assert.equal(instance.prop_b, 2); |
| 46 | assert.equal(instance.prop_text, "world"); |
| 47 | ``` |
| 48 | |
| 49 | */ |
| 50 | |