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