1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4
5export struct Player := {
6 skill-profile: int,
7}
8export struct NewGameTeam := {
9 players: [Player],
10}
11export struct NewGameParameters := {
12 teams: [NewGameTeam],
13}
14
15
16struct StructWithArrayOfStruct := { prop: [{hello: string, world: int}], xxx: int }
17
18TestCase := Rectangle {
19 property <[int]> p1 : [ 12, 13 ];
20 property <[float]> p2 : [ 14, 15.5 ];
21 property <[string]> p3 : [ ];
22 property <[{a: int, b: int}]> p4 : [ { a: 1 }, { a: 42, b: 10 } ];
23 property <StructWithArrayOfStruct> p5 : { prop: [{hello: "hello"}, {world: 42.0 }]};
24
25 property <NewGameParameters> p6 : { teams: [{ players: [ { skill-profile: 9 } ] }] } ;
26}
27
28
29/*
30```js
31var instance = new slint.TestCase({});
32assert.deepEqual(Array.from(instance.p1), [12, 13]);
33assert.deepEqual(Array.from(instance.p2), [14, 15.5]);
34assert.deepEqual(Array.from(instance.p3), []);
35assert.deepEqual(Array.from(instance.p4), [{a: 1, b: 0}, {a: 42, b: 10}]);
36let p5val = instance.p5;
37p5val.prop = Array.from(p5val.prop);
38assert.deepEqual(p5val, { prop: [{hello: "hello", world: 0}, { hello: "", world: 42}], xxx: 0 });
39
40instance.p3 = ["Hello", "World"];
41assert.deepEqual(Array.from(instance.p3), ["Hello", "World"]);
42```
43*/
44