1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
3 | |
4 | // Test the propagation of maximum and minimum size through nested grid layouts |
5 | |
6 | Btn := Rectangle { |
7 | property <string> text; |
8 | |
9 | t := Text { |
10 | text: root.text; |
11 | width: 100%; height: 100%; |
12 | } |
13 | |
14 | accessible-label: text; |
15 | accessible-role: button; |
16 | } |
17 | |
18 | Cb := Rectangle { |
19 | property <string> text; |
20 | accessible-label: text; |
21 | t := Text { } |
22 | accessible-description <=> t.text; |
23 | accessible-role: checkbox; |
24 | accessible-checked: true; |
25 | } |
26 | |
27 | TestCase := Rectangle { |
28 | width: 300phx; |
29 | height: 300phx; |
30 | |
31 | vl := VerticalLayout { |
32 | b1 := Btn { |
33 | text: "plus" ; |
34 | } |
35 | |
36 | txt := Text { |
37 | text: "automatic text value" ; |
38 | } |
39 | |
40 | |
41 | b2 := Btn { |
42 | text : "minus" ; |
43 | } |
44 | |
45 | cb := Cb { text: "hello" ; } |
46 | } |
47 | |
48 | for t in ["abc" ] : Text { text: t; accessible-description: t; } |
49 | |
50 | property<AccessibleRole> materialized_b1_role: b1.accessible_role; |
51 | property<string> materialized_b2_label: b2.accessible-label; |
52 | property<string> materialized_vl_label: vl.accessible-label; |
53 | property<AccessibleRole> materialized_vl_role: vl.accessible-role; |
54 | property<AccessibleRole> materialized_txt_role: txt.accessible-role; |
55 | property<string> materialized_txt_label: txt.accessible-label; |
56 | |
57 | property <bool> test: |
58 | materialized_b1_role == AccessibleRole.button && materialized_b2_label == "minus" |
59 | && materialized_vl_label == "" && materialized_vl_role == AccessibleRole.none |
60 | && materialized_txt_label == "automatic text value" && materialized_txt_role == AccessibleRole.text |
61 | && cb.accessible-checked && !b1.accessible-checked; |
62 | } |
63 | |
64 | |
65 | /* |
66 | |
67 | ```cpp |
68 | auto handle = TestCase::create(); |
69 | const TestCase &instance = *handle; |
70 | assert(instance.get_test()); |
71 | ``` |
72 | |
73 | |
74 | ```rust |
75 | let instance = TestCase::new().unwrap(); |
76 | assert!(instance.get_test()); |
77 | ``` |
78 | |
79 | ```js |
80 | var instance = new slint.TestCase(); |
81 | assert(instance.test); |
82 | ``` |
83 | |
84 | */ |
85 | |