| 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 | |
| 5 | export struct SA { |
| 6 | is-set: bool, |
| 7 | zoom-range: float, |
| 8 | } |
| 9 | export struct SB { |
| 10 | is-set: bool, |
| 11 | } |
| 12 | |
| 13 | export struct Model { |
| 14 | fov: SA, |
| 15 | tilt-speed: SB, |
| 16 | } |
| 17 | |
| 18 | |
| 19 | export struct EvenMoreComplex { |
| 20 | m1: Model, |
| 21 | m2: Model, |
| 22 | xx: bool, |
| 23 | } |
| 24 | |
| 25 | export component TestCase inherits Window{ |
| 26 | |
| 27 | preferred-width: 600px; |
| 28 | preferred-height: 320px; |
| 29 | |
| 30 | in-out property <Model> local: { |
| 31 | { |
| 32 | fov: { |
| 33 | is-set: false, |
| 34 | }, |
| 35 | tilt-speed: { |
| 36 | is-set: true, |
| 37 | }, |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | in-out property <EvenMoreComplex> p2: { |
| 42 | { |
| 43 | m1: { fov: { zoom-range: 5 }, tilt-speed: { is-set: true } }, |
| 44 | m2: { tilt-speed: local.tilt-speed, fov: { is-set: local.fov.is-set } }, |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | init => { |
| 49 | debug(p2); |
| 50 | local.fov = { is-set: true } |
| 51 | } |
| 52 | out property <bool> test: p2.m2.fov.is-set && p2.m1.fov.zoom-range == 5 && !p2.m1.fov.is-set; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | /* |
| 57 | ```cpp |
| 58 | auto handle = TestCase::create(); |
| 59 | const TestCase &instance = *handle; |
| 60 | assert(instance.get_test()); |
| 61 | ``` |
| 62 | |
| 63 | ```rust |
| 64 | let instance = TestCase::new().unwrap(); |
| 65 | assert!(instance.get_test()); |
| 66 | ``` |
| 67 | |
| 68 | ```js |
| 69 | var instance = new slint.TestCase({}); |
| 70 | assert(instance.test); |
| 71 | ``` |
| 72 | */ |
| 73 | |
| 74 | |
| 75 | |
| 76 | |