slint/tests/cases/layout/nested_grid_minmax.60
2021-08-17 22:38:16 +02:00

60 lines
1.6 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
// Test the propagation of maximum and minimum size through nested grid layouts
TestCase := Rectangle {
width: 300phx;
height: 300phx;
GridLayout {
spacing: 0phx;
padding: 0phx;
Row {
GridLayout {
spacing: 0phx;
padding: 0phx;
rect1 := Rectangle {
background: red;
max_width: 50phx;
min_height: 20phx;
max_height: 20phx;
}
rect2 := Rectangle {
row: 0;
col: 1;
background: blue;
}
}
}
}
property <bool> rect1_pos_ok: rect1.x == 0phx && rect1.y == 0phx && rect1.width == 50phx && rect1.height == 20phx;
property <bool> rect2_pos_ok: rect2.x == 50phx && rect2.y == 0phx && rect2.width == 250phx && rect2.height == 20phx;
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(instance.get_rect1_pos_ok());
assert(instance.get_rect2_pos_ok());
```
```rust
let instance = TestCase::new();
assert!(instance.get_rect1_pos_ok());
assert!(instance.get_rect2_pos_ok());
```
// FIXME:: interpreter test
*/