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> t1: floor(42.2);
7 property<int> t2: floor(23.5);
8 property<int> t3: floor(24.6);
9 property<int> t4: floor(25);
10
11 property<int> n1: floor(-42.2);
12 property<int> n2: floor(-23.5);
13 property<int> n3: floor(-24.6);
14 property<int> n4: floor(-25);
15}
16/*
17```cpp
18auto handle = TestCase::create();
19const TestCase &instance = *handle;
20assert_eq(instance.get_t1(), 42);
21assert_eq(instance.get_t2(), 23);
22assert_eq(instance.get_t3(), 24);
23assert_eq(instance.get_t4(), 25);
24assert_eq(instance.get_n1(), -43);
25assert_eq(instance.get_n2(), -24);
26assert_eq(instance.get_n3(), -25);
27assert_eq(instance.get_n4(), -25);
28```
29
30```rust
31let instance = TestCase::new().unwrap();
32assert_eq!(instance.get_t1(), 42);
33assert_eq!(instance.get_t2(), 23);
34assert_eq!(instance.get_t3(), 24);
35assert_eq!(instance.get_t4(), 25);
36assert_eq!(instance.get_n1(), -43);
37assert_eq!(instance.get_n2(), -24);
38assert_eq!(instance.get_n3(), -25);
39assert_eq!(instance.get_n4(), -25);
40```
41
42```js
43var instance = new slint.TestCase({});
44assert.equal(instance.t1, 42);
45assert.equal(instance.t2, 23);
46assert.equal(instance.t3, 24);
47assert.equal(instance.t4, 25);
48assert.equal(instance.n1, -43);
49assert.equal(instance.n2, -24);
50assert.equal(instance.n3, -25);
51assert.equal(instance.n4, -25);
52```
53*/
54}
55
56#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
57 use i_slint_backend_testing as slint_testing;
58 slint_testing::init();
59 let instance = TestCase::new().unwrap();
60 assert_eq!(instance.get_t1(), 42);
61 assert_eq!(instance.get_t2(), 23);
62 assert_eq!(instance.get_t3(), 24);
63 assert_eq!(instance.get_t4(), 25);
64 assert_eq!(instance.get_n1(), -43);
65 assert_eq!(instance.get_n2(), -24);
66 assert_eq!(instance.get_n3(), -25);
67 assert_eq!(instance.get_n4(), -25);
68 Ok(())
69}