mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
I kept seeing distracting warnings when working with these testcases, and it's better to have good examples when writing new testcases. I didn't touch the issue_*.slint regression tests, so those will still be testing the old syntax.
45 lines
1 KiB
Text
45 lines
1 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
export component TestCase inherits Window {
|
|
VerticalLayout {
|
|
padding: 10px;
|
|
spacing: 27px;
|
|
Rectangle {
|
|
background: blue;
|
|
preferred-width: 25phx;
|
|
preferred-height: 500phx;
|
|
horizontal-stretch: 0;
|
|
vertical-stretch: 0;
|
|
}
|
|
Rectangle {
|
|
background: green;
|
|
// implicit: horizontal-stretch: 1
|
|
}
|
|
}
|
|
|
|
out property w <=> root.preferred-width;
|
|
|
|
out property <bool> test: root.preferred_height == 500phx + 20px + 27px && root.preferred_width == 25phx + 20px;
|
|
}
|
|
|
|
/*
|
|
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert(instance.get_test());
|
|
```
|
|
|
|
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert!(instance.get_test());
|
|
```
|
|
|
|
```js
|
|
var instance = new slint.TestCase();
|
|
assert(instance.test);
|
|
```
|
|
|
|
*/
|