1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/types"#]
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
5export enum Foo { bli, bla, blu }
6
7// (override the builtin 'InputType')
8export enum InputType { Xxx, Yyy, Zzz }
9
10export enum With-dash { hallo, hello-world, halloWorld}
11
12export component TestCase {
13 in-out property<Foo> foo: Foo.bla;
14 in-out property<Foo> default;
15
16 in-out property<InputType> input-type: InputType.Xxx;
17
18 out property <bool> test: foo == Foo.bla && default == Foo.bli && input-type == InputType.Xxx;
19
20 in property <With-dash> dash: halloWorld;
21}
22
23/*
24```rust
25let instance = TestCase::new().unwrap();
26
27assert_eq!(instance.get_foo(), Foo::Bla);
28assert!(instance.get_test());
29instance.set_foo(Foo::Blu);
30assert!(!instance.get_test());
31
32assert_eq!(instance.get_dash(), With_dash::HalloWorld);
33instance.set_dash(With_dash::Hallo);
34instance.set_dash(With_dash::HelloWorld);
35
36```
37
38```cpp
39auto handle = TestCase::create();
40const TestCase &instance = *handle;
41
42assert(instance.get_foo() == Foo::Bla);
43assert(instance.get_test());
44instance.set_foo(Foo::Blu);
45assert(!instance.get_test());
46
47assert(instance.get_dash() == With_dash::HalloWorld);
48instance.set_dash(With_dash::Hallo);
49instance.set_dash(With_dash::HelloWorld);
50```
51
52*/
53}
54
55#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
56 use i_slint_backend_testing as slint_testing;
57 slint_testing::init();
58 let instance = TestCase::new().unwrap();
59
60 assert_eq!(instance.get_foo(), Foo::Bla);
61 assert!(instance.get_test());
62 instance.set_foo(Foo::Blu);
63 assert!(!instance.get_test());
64
65 assert_eq!(instance.get_dash(), With_dash::HalloWorld);
66 instance.set_dash(With_dash::Hallo);
67 instance.set_dash(With_dash::HelloWorld);
68
69 Ok(())
70}