1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/types"# ] |
2 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
3 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
4 | |
5 | struct KeySlot { width-u: float, spacer: bool, background: color, font-size: length, } |
6 | struct Row { key-slots: [KeySlot], } |
7 | struct Layer { default-key-width-u: float, total-width-u: float, rows: [Row] } |
8 | |
9 | |
10 | |
11 | export component TestCase { |
12 | // issue #3574 |
13 | out property<[Layer]> layers: [ { |
14 | default-key-width-u: 1.0, |
15 | total-width-u: 10.0, |
16 | rows: [ |
17 | { key-slots: [ { width-u: 0.5}, { spacer: true, width-u: 0.5}, ] }, |
18 | { key-slots: [ { width-u: 2.5, background: #bbbbbb }, ] } |
19 | ], |
20 | } ]; |
21 | |
22 | property <[[{a: string, b: string, c: string}]]> array : [ |
23 | [{a: "hello" }], |
24 | [], |
25 | [{a: "world" }, {a: "extra" , b: "ok" } ], |
26 | ]; |
27 | out property <bool> test: array[2][1].b == "ok" && layers[0].rows[0].key-slots[1].spacer; |
28 | } |
29 | |
30 | |
31 | |
32 | /* |
33 | |
34 | ```cpp |
35 | auto handle = TestCase::create(); |
36 | const TestCase &instance = *handle; |
37 | assert(instance.get_test()); |
38 | ``` |
39 | |
40 | |
41 | ```rust |
42 | let instance = TestCase::new().unwrap(); |
43 | assert!(instance.get_test()); |
44 | ``` |
45 | |
46 | ```js |
47 | var instance = new slint.TestCase({}); |
48 | assert(instance.test); |
49 | ``` |
50 | |
51 | */ |
52 | } |
53 | |
54 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
55 | use i_slint_backend_testing as slint_testing; |
56 | slint_testing::init(); |
57 | let instance = TestCase::new().unwrap(); |
58 | assert!(instance.get_test()); |
59 | Ok(()) |
60 | } |