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 | |
6 | export struct Player := { |
7 | skill-profile: int, |
8 | } |
9 | export struct NewGameTeam := { |
10 | players: [Player], |
11 | } |
12 | export struct NewGameParameters := { |
13 | teams: [NewGameTeam], |
14 | } |
15 | |
16 | |
17 | struct StructWithArrayOfStruct := { prop: [{hello: string, world: int}], xxx: int } |
18 | |
19 | TestCase := Rectangle { |
20 | property <[int]> p1 : [ 12, 13 ]; |
21 | property <[float]> p2 : [ 14, 15.5 ]; |
22 | property <[string]> p3 : [ ]; |
23 | property <[{a: int, b: int}]> p4 : [ { a: 1 }, { a: 42, b: 10 } ]; |
24 | property <StructWithArrayOfStruct> p5 : { prop: [{hello: "hello" }, {world: 42.0 }]}; |
25 | |
26 | property <NewGameParameters> p6 : { teams: [{ players: [ { skill-profile: 9 } ] }] } ; |
27 | } |
28 | |
29 | |
30 | /* |
31 | ```js |
32 | var instance = new slint.TestCase({}); |
33 | assert.deepEqual(Array.from(instance.p1), [12, 13]); |
34 | assert.deepEqual(Array.from(instance.p2), [14, 15.5]); |
35 | assert.deepEqual(Array.from(instance.p3), []); |
36 | assert.deepEqual(Array.from(instance.p4), [{a: 1, b: 0}, {a: 42, b: 10}]); |
37 | let p5val = instance.p5; |
38 | p5val.prop = Array.from(p5val.prop); |
39 | assert.deepEqual(p5val, { prop: [{hello: "hello", world: 0}, { hello: "", world: 42}], xxx: 0 }); |
40 | |
41 | instance.p3 = ["Hello", "World"]; |
42 | assert.deepEqual(Array.from(instance.p3), ["Hello", "World"]); |
43 | ``` |
44 | */ |
45 | } |
46 | |