1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4// Test the propagation of maximum and minimum size through nested grid layouts
5
6TestCase := Rectangle {
7 width: 300phx;
8 height: 300phx;
9
10 GridLayout {
11 spacing: 0phx;
12 padding: 0phx;
13 Row {
14 GridLayout {
15 spacing: 0phx;
16 padding: 0phx;
17 rect1 := Rectangle {
18 background: red;
19 max_width: 50phx;
20 min_height: 20phx;
21 max_height: 20phx;
22 }
23 rect2 := Rectangle {
24 row: 0;
25 col: 1;
26 background: blue;
27 }
28 }
29 }
30 }
31
32 property <bool> rect1_pos_ok: rect1.x == 0phx && rect1.y == 0phx && rect1.width == 50phx && rect1.height == 20phx;
33 property <bool> rect2_pos_ok: rect2.x == 50phx && rect2.y == 0phx && rect2.width == 250phx && rect2.height == 20phx;
34}
35
36/*
37
38```cpp
39auto handle = TestCase::create();
40const TestCase &instance = *handle;
41assert(instance.get_rect1_pos_ok());
42assert(instance.get_rect2_pos_ok());
43```
44
45
46```rust
47let instance = TestCase::new().unwrap();
48assert!(instance.get_rect1_pos_ok());
49assert!(instance.get_rect2_pos_ok());
50```
51
52// FIXME:: interpreter test
53
54*/
55