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<float> t1: sin(0);
7 property<float> t2: sin(180deg);
8 property<float> t3: sin(30deg);
9 property<float> t4: sin(90deg);
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()) < 0.0001);
17assert(std::abs(instance.get_t3() - 0.5) < 0.0001);
18assert(std::abs(instance.get_t4() - 1.0) < 0.0001);
19```
20
21```rust
22let instance = TestCase::new().unwrap();
23assert!(instance.get_t1().abs() < 0.0001);
24assert!(instance.get_t2().abs() < 0.0001);
25assert!((instance.get_t3() - 0.5).abs() < 0.0001);
26assert!((instance.get_t4() - 1.0).abs() < 0.0001);
27```
28
29```js
30var instance = new slint.TestCase({});
31assert(Math.abs(instance.t1) < 0.0001);
32assert(Math.abs(instance.t2) < 0.0001);
33assert(Math.abs(instance.t3 - 0.5) < 0.0001);
34assert(Math.abs(instance.t4 - 1) < 0.0001);
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().abs() < 0.0001);
45 assert!((instance.get_t3() - 0.5).abs() < 0.0001);
46 assert!((instance.get_t4() - 1.0).abs() < 0.0001);
47 Ok(())
48}