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
5// Test the propagation of maximum and minimum size through nested grid layouts
6
7TestCase := Rectangle {
8 width: 300phx;
9 height: 300phx;
10
11 GridLayout {
12 spacing: 0phx;
13 padding: 0phx;
14 Row {
15 GridLayout {
16 spacing: 0phx;
17 padding: 0phx;
18 rect1 := Rectangle {
19 background: red;
20 max_width: 50phx;
21 min_height: 20phx;
22 max_height: 20phx;
23 }
24 rect2 := Rectangle {
25 row: 0;
26 col: 1;
27 background: blue;
28 }
29 }
30 }
31 }
32
33 property <bool> rect1_pos_ok: rect1.x == 0phx && rect1.y == 0phx && rect1.width == 50phx && rect1.height == 20phx;
34 property <bool> rect2_pos_ok: rect2.x == 50phx && rect2.y == 0phx && rect2.width == 250phx && rect2.height == 20phx;
35}
36
37/*
38
39```cpp
40auto handle = TestCase::create();
41const TestCase &instance = *handle;
42assert(instance.get_rect1_pos_ok());
43assert(instance.get_rect2_pos_ok());
44```
45
46
47```rust
48let instance = TestCase::new().unwrap();
49assert!(instance.get_rect1_pos_ok());
50assert!(instance.get_rect2_pos_ok());
51```
52
53// FIXME:: interpreter test
54
55*/
56}
57
58#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
59 use i_slint_backend_testing as slint_testing;
60 slint_testing::init();
61 let instance = TestCase::new().unwrap();
62 assert!(instance.get_rect1_pos_ok());
63 assert!(instance.get_rect2_pos_ok());
64 Ok(())
65}