1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/accessibility"#]
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// Test the propagation of maximum and minimum size through nested grid layouts
6
7Btn := Rectangle {
8 property <string> text;
9
10 t := Text {
11 text: root.text;
12 width: 100%; height: 100%;
13 }
14
15 accessible-label: text;
16 accessible-role: button;
17}
18
19Cb := Rectangle {
20 property <string> text;
21 accessible-label: text;
22 t := Text { }
23 accessible-description <=> t.text;
24 accessible-role: checkbox;
25 accessible-checked: true;
26}
27
28TestCase := Rectangle {
29 width: 300phx;
30 height: 300phx;
31
32 vl := VerticalLayout {
33 b1 := Btn {
34 text: "plus";
35 }
36
37 txt := Text {
38 text: "automatic text value";
39 }
40
41
42 b2 := Btn {
43 text : "minus";
44 }
45
46 cb := Cb { text: "hello"; }
47 }
48
49 for t in ["abc"] : Text { text: t; accessible-description: t; }
50
51 property<AccessibleRole> materialized_b1_role: b1.accessible_role;
52 property<string> materialized_b2_label: b2.accessible-label;
53 property<string> materialized_vl_label: vl.accessible-label;
54 property<AccessibleRole> materialized_vl_role: vl.accessible-role;
55 property<AccessibleRole> materialized_txt_role: txt.accessible-role;
56 property<string> materialized_txt_label: txt.accessible-label;
57
58 property <bool> test:
59 materialized_b1_role == AccessibleRole.button && materialized_b2_label == "minus"
60 && materialized_vl_label == "" && materialized_vl_role == AccessibleRole.none
61 && materialized_txt_label == "automatic text value" && materialized_txt_role == AccessibleRole.text
62 && cb.accessible-checked && !b1.accessible-checked;
63}
64
65
66/*
67
68```cpp
69auto handle = TestCase::create();
70const TestCase &instance = *handle;
71assert(instance.get_test());
72```
73
74
75```rust
76let instance = TestCase::new().unwrap();
77assert!(instance.get_test());
78```
79
80```js
81var instance = new slint.TestCase();
82assert(instance.test);
83```
84
85*/
86}
87
88#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
89 use i_slint_backend_testing as slint_testing;
90 slint_testing::init();
91 let instance = TestCase::new().unwrap();
92 assert!(instance.get_test());
93 Ok(())
94}