mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
35 lines
987 B
Text
35 lines
987 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
TestCase := Rectangle {
|
|
property<float> t1: abs(42.3);
|
|
property<float> t2: abs(-42.3);
|
|
property<int> t3: abs(42.3);
|
|
property<int> t4: abs(-42.3);
|
|
}
|
|
/*
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert(std::abs(instance.get_t1() - 42.3) < 0.0001);
|
|
assert(std::abs(instance.get_t2() - 42.3) < 0.0001);
|
|
assert_eq(instance.get_t3(), 42);
|
|
assert_eq(instance.get_t4(), 42);
|
|
```
|
|
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert_eq!(instance.get_t1(), 42.3);
|
|
assert_eq!(instance.get_t2(), 42.3);
|
|
assert_eq!(instance.get_t3(), 42);
|
|
assert_eq!(instance.get_t4(), 42);
|
|
```
|
|
|
|
```js
|
|
var instance = new slint.TestCase({});
|
|
assert(Math.abs(instance.t1 - 42.3) < 0.0001);
|
|
assert(Math.abs(instance.t2 - 42.3) < 0.0001);
|
|
assert.equal(instance.t3, 42);
|
|
assert.equal(instance.t4, 42);
|
|
```
|
|
*/
|