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 <int> a;
7 property <float> t1: max(41, 12, min(100, 12), max(-10000, 0+98.5), -4) + min(a, 0.5);
8 property <bool> t2: round(10/4) == 3 && floor(10/4) == 2 && ceil(10/4) == 3;
9
10 r := Rectangle {
11 property <int> max: 42;
12 property <int> xx: Math.max(1, 2, 3) + max;
13 }
14 property <bool> test: t2 && r.xx == 42 + 3;
15}
16/*
17```cpp
18auto handle = TestCase::create();
19const TestCase &instance = *handle;
20assert_eq(instance.get_t1(), 98.5);
21assert_eq(instance.get_t2(), true);
22```
23
24
25```rust
26let instance = TestCase::new().unwrap();
27assert_eq!(instance.get_t1(), 98.5);
28assert_eq!(instance.get_t2(), true);
29```
30
31```js
32var instance = new slint.TestCase({});
33assert.equal(instance.t1, 98.5);
34assert(instance.t2);
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(), 98.5);
44 assert_eq!(instance.get_t2(), true);
45 Ok(())
46}