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: abs(42.3);
7 property<float> t2: abs(-42.3);
8 property<int> t3: abs(42.3);
9 property<int> t4: abs(-42.3);
10}
11/*
12```cpp
13auto handle = TestCase::create();
14const TestCase &instance = *handle;
15assert(std::abs(instance.get_t1() - 42.3) < 0.0001);
16assert(std::abs(instance.get_t2() - 42.3) < 0.0001);
17assert_eq(instance.get_t3(), 42);
18assert_eq(instance.get_t4(), 42);
19```
20
21```rust
22let instance = TestCase::new().unwrap();
23assert_eq!(instance.get_t1(), 42.3);
24assert_eq!(instance.get_t2(), 42.3);
25assert_eq!(instance.get_t3(), 42);
26assert_eq!(instance.get_t4(), 42);
27```
28
29```js
30var instance = new slint.TestCase({});
31assert(Math.abs(instance.t1 - 42.3) < 0.0001);
32assert(Math.abs(instance.t2 - 42.3) < 0.0001);
33assert.equal(instance.t3, 42);
34assert.equal(instance.t4, 42);
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_eq!(instance.get_t1(), 42.3);
44 assert_eq!(instance.get_t2(), 42.3);
45 assert_eq!(instance.get_t3(), 42);
46 assert_eq!(instance.get_t4(), 42);
47 Ok(())
48}