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