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