1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/layout"#]
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
5TestCase := Rectangle {
6 width: 600phx;
7 height: 300phx;
8
9 Rectangle {
10 width: 300phx;
11 height: 300phx;
12 GridLayout {
13 spacing: 10phx;
14 Row {
15 Rectangle {
16 width: 5phx;
17 height: 5phx;
18 background: red;
19 }
20
21 rect1 := Rectangle {
22 width: 5phx;
23 height: 5phx;
24 background: red;
25 }
26 }
27
28 Row {
29 Rectangle {
30 width: 5phx;
31 height: 5phx;
32 background: red;
33 }
34
35 rect2 := Rectangle {
36 width: 5phx;
37 height: 5phx;
38 background: red;
39 }
40 }
41 }
42 }
43
44 property <bool> rect1_pos_ok: rect1.x == 15phx && rect1.y == 0phx;
45 property <bool> rect2_pos_ok: rect2.x == 15phx && rect2.y == 15phx;
46
47 Rectangle {
48 width: 300phx;
49 height: 300phx;
50 GridLayout {
51 spacing-horizontal: 20phx;
52 spacing-vertical: 30phx;
53 spacing: 10phx;
54 Row {
55 Rectangle {
56 width: 5phx;
57 height: 5phx;
58 background: red;
59 }
60
61 rect3 := Rectangle {
62 width: 5phx;
63 height: 5phx;
64 background: red;
65 }
66 }
67
68 Row {
69 Rectangle {
70 width: 5phx;
71 height: 5phx;
72 background: red;
73 }
74
75 rect4 := Rectangle {
76 width: 5phx;
77 height: 5phx;
78 background: red;
79 }
80 }
81 }
82 }
83
84 property <bool> rect3_pos_ok: rect3.x == 25phx && rect3.y == 0phx;
85 property <bool> rect4_pos_ok: rect4.x == 25phx && rect4.y == 35phx;
86
87 out property <bool> test: rect1_pos_ok && rect2_pos_ok &&rect3_pos_ok && rect4_pos_ok;
88}
89
90/*
91
92```cpp
93auto handle = TestCase::create();
94const TestCase &instance = *handle;
95assert(instance.get_rect1_pos_ok());
96assert(instance.get_rect2_pos_ok());
97assert(instance.get_rect3_pos_ok());
98assert(instance.get_rect4_pos_ok());
99```
100
101
102```rust
103let instance = TestCase::new().unwrap();
104assert!(instance.get_rect1_pos_ok());
105assert!(instance.get_rect2_pos_ok());
106assert!(instance.get_rect3_pos_ok());
107assert!(instance.get_rect4_pos_ok());
108```
109
110*/
111}
112
113#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
114 use i_slint_backend_testing as slint_testing;
115 slint_testing::init();
116 let instance = TestCase::new().unwrap();
117 assert!(instance.get_rect1_pos_ok());
118 assert!(instance.get_rect2_pos_ok());
119 assert!(instance.get_rect3_pos_ok());
120 assert!(instance.get_rect4_pos_ok());
121 Ok(())
122}