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 |
15 | auto handle = TestCase::create(); |
16 | const TestCase &instance = *handle; |
17 | assert_eq(instance.get_t1(), 0); |
18 | assert_eq(instance.get_t2(), 8.5); |
19 | assert_eq(instance.get_t3(),3); |
20 | assert_eq(instance.get_t4(),432); |
21 | ``` |
22 | |
23 | |
24 | ```rust |
25 | let instance = TestCase::new().unwrap(); |
26 | assert_eq!(instance.get_t1(), 0); |
27 | assert_eq!(instance.get_t2(), 8.5); |
28 | assert_eq!(instance.get_t3(), 3); |
29 | assert_eq!(instance.get_t4(),432); |
30 | ``` |
31 | |
32 | ```js |
33 | var instance = new slint.TestCase({}); |
34 | assert.equal(instance.t1, 0); |
35 | assert.equal(instance.t2, 8.5); |
36 | assert.equal(instance.t3, 3); |
37 | assert.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 | } |