slint/tests/cases/expr/minmax.60
2021-07-02 15:55:54 +02:00

35 lines
1,011 B
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 {
property <int> a;
property <float> t1: max(41, 12, min(100, 12), max(-10000, 0+98.5), -4) + min(a, 0.5);
property <bool> t2: round(10/4) == 3 && floor(10/4) == 2 && ceil(10/4) == 3;
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert_eq(instance.get_t1(), 98.5);
assert_eq(instance.get_t2(), true);
```
```rust
let instance = TestCase::new();
assert_eq!(instance.get_t1(), 98.5);
assert_eq!(instance.get_t2(), true);
```
```js
var instance = new sixtyfps.TestCase({});
assert.equal(instance.t1, 98.5);
assert(instance.t2);
```
*/