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: pow(4.0, 2); |
7 | property<float> t2: pow(9, 3.0); |
8 | } |
9 | /* |
10 | ```cpp |
11 | auto handle = TestCase::create(); |
12 | const TestCase &instance = *handle; |
13 | assert_eq(instance.get_t1(), 16.0); |
14 | assert_eq(instance.get_t2(), 729.0); |
15 | ``` |
16 | |
17 | ```rust |
18 | let instance = TestCase::new().unwrap(); |
19 | assert_eq!(instance.get_t1(), 16.0); |
20 | assert_eq!(instance.get_t2(), 729.0); |
21 | ``` |
22 | |
23 | ```js |
24 | var instance = new slint.TestCase({}); |
25 | assert.equal(instance.t1, 16); |
26 | assert.equal(instance.t2, 729); |
27 | ``` |
28 | */ |
29 | } |
30 | |
31 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
32 | use i_slint_backend_testing as slint_testing; |
33 | slint_testing::init(); |
34 | let instance = TestCase::new().unwrap(); |
35 | assert_eq!(instance.get_t1(), 16.0); |
36 | assert_eq!(instance.get_t2(), 729.0); |
37 | Ok(()) |
38 | } |