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 | O := Text { |
6 | property <int> val; |
7 | text: val; |
8 | property <int> a: val + 1; |
9 | } |
10 | |
11 | TestCase := Window { |
12 | property <int> val: condition ? 2 : 4; |
13 | property <bool> condition : false; |
14 | HorizontalLayout { |
15 | o1 := O { val <=> root.val; } |
16 | o2 := O { val <=> root.val; } |
17 | o3 := O { val <=> root.val; } |
18 | o4 := O { val <=> root.val; } |
19 | o5 := O { val <=> root.val; } |
20 | } |
21 | property <int> checksum: 10000 * o1.a + 1000 * o2.a + 100 * o3.a + 10 * o4.a + 1 * o5.a; |
22 | property <bool> test: checksum == 55555; |
23 | } |
24 | |
25 | |
26 | /* |
27 | |
28 | ```rust |
29 | let instance = TestCase::new().unwrap(); |
30 | assert_eq!(instance.get_checksum(), 55555); |
31 | instance.set_condition(true); |
32 | assert_eq!(instance.get_checksum(), 33333); |
33 | ``` |
34 | |
35 | |
36 | |
37 | ```cpp |
38 | auto handle = TestCase::create(); |
39 | const TestCase &instance = *handle; |
40 | assert_eq(instance.get_checksum(), 55555); |
41 | instance.set_condition(true); |
42 | assert_eq(instance.get_checksum(), 33333); |
43 | ``` |
44 | |
45 | |
46 | ```js |
47 | let instance = new slint.TestCase({}); |
48 | assert.equal(instance.checksum, 55555); |
49 | instance.condition = true; |
50 | assert.equal(instance.checksum, 33333); |
51 | ``` |
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_checksum(), 55555); |
61 | instance.set_condition(true); |
62 | assert_eq!(instance.get_checksum(), 33333); |
63 | Ok(()) |
64 | } |