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

32 lines
923 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 <bool> test_sqrt: sqrt(100) == 10 && sqrt(1) == 1 && sqrt(6.25) == 2.5;
property <bool> test_abs: abs(100.5) == 100.5 && abs(-200.5) == 200.5 && abs(0) == 0;
property <bool> test: test_sqrt && test_abs;
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(instance.get_test());
```
```rust
let instance = TestCase::new();
assert!(instance.get_test());
```
```js
var instance = new sixtyfps.TestCase({});
assert(instance.test);
```
*/