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<angle> t1: asin(0); |
7 | property<angle> t2: asin(0.5); |
8 | property<angle> t3: asin(1); |
9 | } |
10 | /* |
11 | ```cpp |
12 | auto handle = TestCase::create(); |
13 | const TestCase &instance = *handle; |
14 | assert(std::abs(instance.get_t1()) < 0.0001); |
15 | assert(std::abs(instance.get_t2() - 30.0) < 0.0001); |
16 | assert(std::abs(instance.get_t3() - 90.0) < 0.0001); |
17 | ``` |
18 | |
19 | ```rust |
20 | let instance = TestCase::new().unwrap(); |
21 | assert!(instance.get_t1().abs() < 0.0001); |
22 | assert!((instance.get_t2() - 30.0).abs() < 0.0001); |
23 | assert!((instance.get_t3() - 90.0).abs() < 0.0001); |
24 | ``` |
25 | |
26 | ```js |
27 | var instance = new slint.TestCase({}); |
28 | assert.equal(instance.t1, 0); |
29 | assert.equal(instance.t2, 30); |
30 | assert.equal(instance.t3, 90); |
31 | ``` |
32 | */ |
33 | } |
34 | |
35 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
36 | use i_slint_backend_testing as slint_testing; |
37 | slint_testing::init(); |
38 | let instance = TestCase::new().unwrap(); |
39 | assert!(instance.get_t1().abs() < 0.0001); |
40 | assert!((instance.get_t2() - 30.0).abs() < 0.0001); |
41 | assert!((instance.get_t3() - 90.0).abs() < 0.0001); |
42 | Ok(()) |
43 | } |