1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/types"#]
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
5Test := Rectangle {
6 property<angle> angle: 0.25turn;
7 property<bool> test: abs((angle - 0.5rad * 3.1415926535)/1grad) < 0.00001;
8}
9
10/*
11```cpp
12auto handle = Test::create();
13const Test &t = *handle;
14assert_eq(t.get_angle(), 90.);
15assert_eq(t.get_test(), true);
16
17t.set_angle(91.);
18assert_eq(t.get_angle(), 91.);
19assert_eq(t.get_test(), false);
20```
21
22
23```rust
24let t = Test::new().unwrap();
25assert_eq!(t.get_angle(), 90.);
26assert_eq!(t.get_test(), true);
27
28t.set_angle(91.);
29assert_eq!(t.get_angle(), 91.);
30assert_eq!(t.get_test(), false);
31```
32
33```js
34var t = new slint.Test({});
35assert.equal(t.angle, 90);
36assert(t.test);
37t.angle = 91;
38assert.equal(t.angle, 91);
39assert(!t.test);
40
41```
42*/
43}
44
45#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
46 use i_slint_backend_testing as slint_testing;
47 slint_testing::init();
48 let t = Test::new().unwrap();
49 assert_eq!(t.get_angle(), 90.);
50 assert_eq!(t.get_test(), true);
51
52 t.set_angle(91.);
53 assert_eq!(t.get_angle(), 91.);
54 assert_eq!(t.get_test(), false);
55 Ok(())
56}