1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/expr"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
4
5 TestCase := Rectangle {
6 property<int> t1: mod(42, 2);
7 property<float> t2: mod(18.5, 10);
8 property<int> t3: mod(153, 10);
9 property <duration> t4: mod(5432ms, 1s);
10
11 property <bool> test: t1 == 0 && t2 == 8.5 && t3 == 3 && t4 == 432ms;
12}
13/*
14```cpp
15auto handle = TestCase::create();
16const TestCase &instance = *handle;
17assert_eq(instance.get_t1(), 0);
18assert_eq(instance.get_t2(), 8.5);
19assert_eq(instance.get_t3(),3);
20assert_eq(instance.get_t4(),432);
21```
22
23
24```rust
25let instance = TestCase::new().unwrap();
26assert_eq!(instance.get_t1(), 0);
27assert_eq!(instance.get_t2(), 8.5);
28assert_eq!(instance.get_t3(), 3);
29assert_eq!(instance.get_t4(),432);
30```
31
32```js
33var instance = new slint.TestCase({});
34assert.equal(instance.t1, 0);
35assert.equal(instance.t2, 8.5);
36assert.equal(instance.t3, 3);
37assert.equal(instance.t4, 432);
38
39```
40*/
41}
42
43#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
44 use i_slint_backend_testing as slint_testing;
45 slint_testing::init();
46 let instance = TestCase::new().unwrap();
47 assert_eq!(instance.get_t1(), 0);
48 assert_eq!(instance.get_t2(), 8.5);
49 assert_eq!(instance.get_t3(), 3);
50 assert_eq!(instance.get_t4(),432);
51 Ok(())
52}