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: 300phx;
7 height: 300phx;
8
9 GridLayout {
10 padding: 0phx;
11 spacing: 0phx;
12
13 Row {
14 Rectangle {
15 background: orange;
16 }
17 }
18 Row {
19 rect1 := Rectangle {
20 background: red;
21 GridLayout {
22 padding: 0phx;
23 spacing: 10px;
24 Row {
25 rect2 := Rectangle {
26 background: green;
27 max_width: 50phx;
28 max_height: 50phx;
29 }
30 rect3 := Rectangle {
31 background: black;
32 }
33 }
34 }
35 }
36 rect4 := Rectangle {
37 background: blue;
38 }
39 }
40 }
41
42 property <bool> rect1_pos_ok: rect1.x == 0phx && rect1.y == 250phx && rect1.width == 155phx && rect1.height == 50phx;
43 property <bool> rect2_pos_ok: rect2.x == 0phx && rect2.y == 0phx && rect2.width == 50phx && rect2.height == 50phx;
44 property <bool> rect3_pos_ok: rect3.x == 60phx && rect3.y == 0phx && rect3.width == 95phx && rect3.height == 50phx;
45 property <bool> rect4_pos_ok: rect4.x == 155phx && rect4.y == 250phx && rect4.width == 145phx && rect4.height == 50phx;
46
47 property <bool> test: rect1_pos_ok && rect2_pos_ok && rect3_pos_ok && rect4_pos_ok;
48}
49
50/*
51
52```cpp
53auto handle = TestCase::create();
54const TestCase &instance = *handle;
55assert(instance.get_rect1_pos_ok());
56assert(instance.get_rect2_pos_ok());
57assert(instance.get_rect3_pos_ok());
58assert(instance.get_rect4_pos_ok());
59```
60
61
62```rust
63let instance = TestCase::new().unwrap();
64assert!(instance.get_rect1_pos_ok());
65assert!(instance.get_rect2_pos_ok());
66assert!(instance.get_rect3_pos_ok());
67assert!(instance.get_rect4_pos_ok());
68```
69
70*/
71}
72
73#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
74 use i_slint_backend_testing as slint_testing;
75 slint_testing::init();
76 let instance = TestCase::new().unwrap();
77 assert!(instance.get_rect1_pos_ok());
78 assert!(instance.get_rect2_pos_ok());
79 assert!(instance.get_rect3_pos_ok());
80 assert!(instance.get_rect4_pos_ok());
81 Ok(())
82}