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 | // The visible and enabled property are set by default by Slint to true. |
6 | // But when overridden by an alias, the overridden value should take precedence. |
7 | |
8 | export Button := Rectangle { |
9 | property<bool> the_enabled <=> touch.enabled; |
10 | property<bool> the_visible <=> touch.visible; |
11 | background: !the_enabled ? blue : red; |
12 | border-color: !the_visible ? green : yellow; |
13 | border-width: 15px; |
14 | touch := TouchArea {} |
15 | fs := FocusScope { |
16 | enabled <=> root.the_enabled; |
17 | visible <=> root.the_visible; |
18 | } |
19 | property <bool> check: !fs.enabled && !touch.enabled && !fs.visible && !touch.visible; |
20 | } |
21 | |
22 | export TestCase := Rectangle { |
23 | VerticalLayout { |
24 | spacing: 10px; |
25 | b1 := Button { the_enabled: false; the_visible: false; } |
26 | b2 := Button { the_enabled: false; the_visible: false; } |
27 | b3 := Button { the_enabled: false; the_visible: false; } |
28 | b4 := Button { the_enabled: false; the_visible: false; } |
29 | b5 := Button { the_enabled: false; the_visible: false; } |
30 | b6 := Button { the_enabled: false; the_visible: false; } |
31 | b7 := Button { the_enabled: false; the_visible: false; } |
32 | } |
33 | |
34 | property <bool> test: b1.check && b2.check && b3.check && b4.check && b5.check && b6.check && b7.check; |
35 | } |
36 | |
37 | |
38 | /* |
39 | |
40 | ```rust |
41 | let instance = TestCase::new().unwrap(); |
42 | assert!(instance.get_test()); |
43 | ``` |
44 | |
45 | |
46 | |
47 | ```cpp |
48 | auto handle = TestCase::create(); |
49 | const TestCase &instance = *handle; |
50 | assert(instance.get_test()); |
51 | ``` |
52 | |
53 | |
54 | ```js |
55 | let instance = new slint.TestCase({}); |
56 | assert(instance.test); |
57 | ``` |
58 | |
59 | */ |
60 | } |
61 | |
62 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
63 | use i_slint_backend_testing as slint_testing; |
64 | slint_testing::init(); |
65 | let instance = TestCase::new().unwrap(); |
66 | assert!(instance.get_test()); |
67 | Ok(()) |
68 | } |