| 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 | TestCase := Rectangle { |
| 5 | |
| 6 | property<int> bar: 5; |
| 7 | property<int> foo: 3; |
| 8 | foo := Rectangle { |
| 9 | property<int> bar: 7; |
| 10 | property<int> foo: 9; |
| 11 | property<int> inner: bar * 10 + self.bar * 100 + parent.bar * 1000; |
| 12 | } |
| 13 | |
| 14 | property<int> p1: foo.inner; |
| 15 | property<int> p2: self.foo *10 + foo.foo * 100 + bar *1000; |
| 16 | } |
| 17 | /* |
| 18 | ```cpp |
| 19 | auto handle = TestCase::create(); |
| 20 | const TestCase &instance = *handle; |
| 21 | assert_eq(instance.get_p1(), 5770); |
| 22 | assert_eq(instance.get_p2(), 5930); |
| 23 | ``` |
| 24 | |
| 25 | ```rust |
| 26 | let instance = TestCase::new().unwrap(); |
| 27 | assert_eq!(instance.get_p1(), 5770); |
| 28 | assert_eq!(instance.get_p2(), 5930); |
| 29 | ``` |
| 30 | |
| 31 | ```js |
| 32 | var instance = new slint.TestCase({}); |
| 33 | assert.equal(instance.p1, 5770); |
| 34 | assert.equal(instance.p2, 5930); |
| 35 | ``` |
| 36 | */ |
| 37 | |