1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/lookup"# ] |
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 | |
7 | property<int> bar: 5; |
8 | property<int> foo: 3; |
9 | foo := Rectangle { |
10 | property<int> bar: 7; |
11 | property<int> foo: 9; |
12 | property<int> inner: bar * 10 + self.bar * 100 + parent.bar * 1000; |
13 | } |
14 | |
15 | property<int> p1: foo.inner; |
16 | property<int> p2: self.foo *10 + foo.foo * 100 + bar *1000; |
17 | } |
18 | /* |
19 | ```cpp |
20 | auto handle = TestCase::create(); |
21 | const TestCase &instance = *handle; |
22 | assert_eq(instance.get_p1(), 5770); |
23 | assert_eq(instance.get_p2(), 5930); |
24 | ``` |
25 | |
26 | ```rust |
27 | let instance = TestCase::new().unwrap(); |
28 | assert_eq!(instance.get_p1(), 5770); |
29 | assert_eq!(instance.get_p2(), 5930); |
30 | ``` |
31 | |
32 | ```js |
33 | var instance = new slint.TestCase({}); |
34 | assert.equal(instance.p1, 5770); |
35 | assert.equal(instance.p2, 5930); |
36 | ``` |
37 | */ |
38 | } |
39 | |
40 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
41 | use i_slint_backend_testing as slint_testing; |
42 | slint_testing::init(); |
43 | let instance = TestCase::new().unwrap(); |
44 | assert_eq!(instance.get_p1(), 5770); |
45 | assert_eq!(instance.get_p2(), 5930); |
46 | Ok(()) |
47 | } |