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: ceil(42.2);
7 property<int> t2: ceil(23.5);
8 property<int> t3: ceil(24.6);
9 property<int> t4: ceil(25);
10
11 property<int> n1: ceil(-42.2);
12 property<int> n2: ceil(-23.5);
13 property<int> n3: ceil(-24.6);
14 property<int> n4: ceil(-25);
15}
16/*
17```cpp
18auto handle = TestCase::create();
19const TestCase &instance = *handle;
20assert_eq(instance.get_t1(), 43);
21assert_eq(instance.get_t2(), 24);
22assert_eq(instance.get_t3(), 25);
23assert_eq(instance.get_t4(), 25);
24assert_eq(instance.get_n1(), -42);
25assert_eq(instance.get_n2(), -23);
26assert_eq(instance.get_n3(), -24);
27assert_eq(instance.get_n4(), -25);
28```
29
30```rust
31let instance = TestCase::new().unwrap();
32assert_eq!(instance.get_t1(), 43);
33assert_eq!(instance.get_t2(), 24);
34assert_eq!(instance.get_t3(), 25);
35assert_eq!(instance.get_t4(), 25);
36assert_eq!(instance.get_n1(), -42);
37assert_eq!(instance.get_n2(), -23);
38assert_eq!(instance.get_n3(), -24);
39assert_eq!(instance.get_n4(), -25);
40```
41
42```js
43var instance = new slint.TestCase({});
44assert.equal(instance.t1, 43);
45assert.equal(instance.t2, 24);
46assert.equal(instance.t3, 25);
47assert.equal(instance.t4, 25);
48assert.equal(instance.n1, -42);
49assert.equal(instance.n2, -23);
50assert.equal(instance.n3, -24);
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(), 43);
61 assert_eq!(instance.get_t2(), 24);
62 assert_eq!(instance.get_t3(), 25);
63 assert_eq!(instance.get_t4(), 25);
64 assert_eq!(instance.get_n1(), -42);
65 assert_eq!(instance.get_n2(), -23);
66 assert_eq!(instance.get_n3(), -24);
67 assert_eq!(instance.get_n4(), -25);
68 Ok(())
69}