1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4Button1 := Rectangle {
5 property <bool> cond;
6 accessible-role: cond ? button : AccessibleRole.text;
7 // ^error{The `accessible-role` property must be a constant expression}
8
9 rr := Rectangle {
10 init => {
11 self.accessible-role = AccessibleRole.text;
12// ^error{The property must be known at compile time and cannot be changed at runtime}
13 }
14 }
15}
16
17Button2 := Rectangle {
18 accessible-label: "the button";
19 // ^error{The `accessible-label` property can only be set in combination to `accessible-role`}
20}
21
22Button3 := Rectangle {
23 Rectangle {
24 accessible-role: text;
25 accessible-label: "the button";
26 }
27}
28
29export Test := Window {
30
31 Button1 { }
32 Button1 { accessible-description: "ok"; } // ok because Button1 has a role
33 Button2 { accessible-role: none; }
34 Button2 { }
35 Button3 {}
36 Button3 { accessible-description: "error";}
37 // ^error{The `accessible-description` property can only be set in combination to `accessible-role`}
38}
39