| 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 | struct KeySlot { width-u: float, spacer: bool, background: color, font-size: length, } |
| 5 | struct Row { key-slots: [KeySlot], } |
| 6 | struct Layer { default-key-width-u: float, total-width-u: float, rows: [Row] } |
| 7 | |
| 8 | |
| 9 | |
| 10 | export component TestCase { |
| 11 | // issue #3574 |
| 12 | out property<[Layer]> layers: [ { |
| 13 | default-key-width-u: 1.0, |
| 14 | total-width-u: 10.0, |
| 15 | rows: [ |
| 16 | { key-slots: [ { width-u: 0.5}, { spacer: true, width-u: 0.5}, ] }, |
| 17 | { key-slots: [ { width-u: 2.5, background: #bbbbbb }, ] } |
| 18 | ], |
| 19 | } ]; |
| 20 | |
| 21 | property <[[{a: string, b: string, c: string}]]> array : [ |
| 22 | [{a: "hello" }], |
| 23 | [], |
| 24 | [{a: "world" }, {a: "extra" , b: "ok" } ], |
| 25 | ]; |
| 26 | out property <bool> test: array[2][1].b == "ok" && layers[0].rows[0].key-slots[1].spacer; |
| 27 | } |
| 28 | |
| 29 | |
| 30 | |
| 31 | /* |
| 32 | |
| 33 | ```cpp |
| 34 | auto handle = TestCase::create(); |
| 35 | const TestCase &instance = *handle; |
| 36 | assert(instance.get_test()); |
| 37 | ``` |
| 38 | |
| 39 | |
| 40 | ```rust |
| 41 | let instance = TestCase::new().unwrap(); |
| 42 | assert!(instance.get_test()); |
| 43 | ``` |
| 44 | |
| 45 | ```js |
| 46 | var instance = new slint.TestCase({}); |
| 47 | assert(instance.test); |
| 48 | ``` |
| 49 | |
| 50 | */ |
| 51 | |