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

72 lines
1.8 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 */
TestCase := Rectangle {
width: 600phx;
height: 300phx;
Rectangle {
width: 300phx;
height: 300phx;
border_color: black;
border_width: 2px;
GridLayout {
padding_top: 10phx;
padding_left: 20phx;
padding_right: 30phx;
padding_bottom: 40phx;
Row {
rect1 := Rectangle {
background: red;
}
}
}
}
Rectangle {
width: 300phx;
height: 300phx;
x: 300phx;
border_color: black;
border_width: 2px;
GridLayout {
spacing: 1000phx;
padding: 25phx;
padding_left: 20phx;
padding_right: 30phx;
Row {
rect2 := Rectangle {
background: blue;
}
}
}
}
property <bool> rect1_pos_ok: rect1.x == 20phx && rect1.y == 10phx && rect1.width == 250phx && rect1.height == 250phx;
property <bool> rect2_pos_ok: rect2.x == 20phx && rect2.y == 25phx && rect2.width == 250phx && rect2.height == 250phx;
}
/*
```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());
```
*/