1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/bindings"# ] |
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 | SubElem := Rectangle { |
6 | property <int> value: 55; |
7 | callback change(); |
8 | change => { value += 44; } |
9 | } |
10 | |
11 | TestCase := Rectangle { |
12 | callback change(); |
13 | change => { sub.change(); sub2.change(); } |
14 | property <int> toplevel: sub.value + sub2.value; |
15 | sub := SubElem { } |
16 | sub2 := SubElem { value : 1; } |
17 | } |
18 | |
19 | |
20 | /* |
21 | |
22 | ```rust |
23 | let instance = TestCase::new().unwrap(); |
24 | assert_eq!(instance.get_toplevel(), 56); |
25 | instance.invoke_change(); |
26 | assert_eq!(instance.get_toplevel(), 56+44+44); |
27 | ``` |
28 | |
29 | |
30 | ```cpp |
31 | auto handle = TestCase::create(); |
32 | const TestCase &instance = *handle; |
33 | assert_eq(instance.get_toplevel(), 56); |
34 | instance.invoke_change(); |
35 | assert_eq(instance.get_toplevel(), 56+44+44); |
36 | ``` |
37 | |
38 | ```js |
39 | var instance = new slint.TestCase({}); |
40 | assert.equal(instance.toplevel, 56); |
41 | instance.change(); |
42 | assert.equal(instance.toplevel, 56+44+44); |
43 | ``` |
44 | |
45 | */ |
46 | } |
47 | |
48 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
49 | use i_slint_backend_testing as slint_testing; |
50 | slint_testing::init(); |
51 | let instance = TestCase::new().unwrap(); |
52 | assert_eq!(instance.get_toplevel(), 56); |
53 | instance.invoke_change(); |
54 | assert_eq!(instance.get_toplevel(), 56+44+44); |
55 | Ok(()) |
56 | } |