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 | export enum Foo { bli, bla, blu } |
5 | |
6 | // (override the builtin 'InputType') |
7 | export enum InputType { Xxx, Yyy, Zzz } |
8 | |
9 | export enum With-dash { hallo, hello-world, halloWorld} |
10 | |
11 | export component TestCase { |
12 | in-out property<Foo> foo: Foo.bla; |
13 | in-out property<Foo> default; |
14 | |
15 | in-out property<InputType> input-type: InputType.Xxx; |
16 | |
17 | out property <bool> test: foo == Foo.bla && default == Foo.bli && input-type == InputType.Xxx; |
18 | |
19 | in property <With-dash> dash: halloWorld; |
20 | } |
21 | |
22 | /* |
23 | ```rust |
24 | let instance = TestCase::new().unwrap(); |
25 | |
26 | assert_eq!(instance.get_foo(), Foo::Bla); |
27 | assert!(instance.get_test()); |
28 | instance.set_foo(Foo::Blu); |
29 | assert!(!instance.get_test()); |
30 | |
31 | assert_eq!(instance.get_dash(), With_dash::HalloWorld); |
32 | instance.set_dash(With_dash::Hallo); |
33 | instance.set_dash(With_dash::HelloWorld); |
34 | |
35 | ``` |
36 | |
37 | ```cpp |
38 | auto handle = TestCase::create(); |
39 | const TestCase &instance = *handle; |
40 | |
41 | assert(instance.get_foo() == Foo::Bla); |
42 | assert(instance.get_test()); |
43 | instance.set_foo(Foo::Blu); |
44 | assert(!instance.get_test()); |
45 | |
46 | assert(instance.get_dash() == With_dash::HalloWorld); |
47 | instance.set_dash(With_dash::Hallo); |
48 | instance.set_dash(With_dash::HelloWorld); |
49 | ``` |
50 | |
51 | */ |
52 | |