mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
58 lines
1.7 KiB
Text
58 lines
1.7 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
|
|
|
|
component TestCase inherits Window {
|
|
out property<int> t1: round(42.2);
|
|
out property<int> t2: round(23.5);
|
|
out property<int> t3: round(24.6);
|
|
out property<int> t4: round(25);
|
|
|
|
out property<int> n1: round(-42.2);
|
|
out property<int> n2: round(-23.5);
|
|
out property<int> n3: round(-24.6);
|
|
out property<int> n4: round(-25);
|
|
|
|
out property <bool> test: 188.9.round() == 189 && (-4.58).round() == -(5.1).round()
|
|
&& round(10.1) != 10.1 && !(30.3 == round(30.3));
|
|
}
|
|
/*
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert_eq(instance.get_t1(), 42);
|
|
assert_eq(instance.get_t2(), 24);
|
|
assert_eq(instance.get_t3(), 25);
|
|
assert_eq(instance.get_t4(), 25);
|
|
assert_eq(instance.get_n1(), -42);
|
|
assert_eq(instance.get_n2(), -24);
|
|
assert_eq(instance.get_n3(), -25);
|
|
assert_eq(instance.get_n4(), -25);
|
|
assert(instance.get_test());
|
|
```
|
|
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert_eq!(instance.get_t1(), 42);
|
|
assert_eq!(instance.get_t2(), 24);
|
|
assert_eq!(instance.get_t3(), 25);
|
|
assert_eq!(instance.get_t4(), 25);
|
|
assert_eq!(instance.get_n1(), -42);
|
|
assert_eq!(instance.get_n2(), -24);
|
|
assert_eq!(instance.get_n3(), -25);
|
|
assert_eq!(instance.get_n4(), -25);
|
|
assert!(instance.get_test());
|
|
```
|
|
|
|
```js
|
|
var instance = new slint.TestCase({});
|
|
assert.equal(instance.t1, 42);
|
|
assert.equal(instance.t2, 24);
|
|
assert.equal(instance.t3, 25);
|
|
assert.equal(instance.t4, 25);
|
|
assert.equal(instance.n1, -42);
|
|
assert.equal(instance.n2, -24);
|
|
assert.equal(instance.n3, -25);
|
|
assert.equal(instance.n4, -25);
|
|
assert(instance.test);
|
|
```
|
|
*/
|