1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/lookup"# ] |
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 | |
6 | // Just use some of the internal names used in Slint to make sure it still compiles |
7 | |
8 | import { Button, ComboBox } from "std-widgets.slint" ; |
9 | |
10 | export struct Some {} |
11 | export struct None { s: Some } |
12 | export struct Option { n: None } |
13 | export struct Component {o: Option } |
14 | export struct Model { c: Component } |
15 | export struct Result { m: Model } |
16 | export struct Ok { r: Result } |
17 | export struct Property { value: string } |
18 | export struct PropertyAnimation { property: Property } |
19 | export struct Callback {} |
20 | export struct Rc {} |
21 | export struct Weak {} |
22 | export enum WindowAdaptor { Window } |
23 | export struct WindowItem {} |
24 | export struct Slint { slint: string } |
25 | export struct LayoutInfo { layout: int } |
26 | export struct BoxLayoutData { layout: length } |
27 | |
28 | |
29 | |
30 | export enum Slice { xxx } |
31 | export enum Coord { xxx } |
32 | //export enum vtable { a, b, c } |
33 | export struct AccessibleRole { value: Coord } |
34 | export enum Default { a, b, c } |
35 | |
36 | |
37 | export global ComponentInstance { |
38 | out property <Ok> ok; |
39 | } |
40 | |
41 | export global GridLayoutCellData { |
42 | callback begin; |
43 | } |
44 | |
45 | export component SharedString { |
46 | out property <Property> slint: { value: "foobar" }; |
47 | property ok <=> ComponentInstance.ok; |
48 | } |
49 | |
50 | export global ItemVTable {} |
51 | |
52 | export component TestCase { |
53 | |
54 | in property <Default> def: Default.b; |
55 | out property <BoxLayoutData> blt: { layout: 45phx }; |
56 | |
57 | slint := SharedString {} |
58 | Button { text: "hello" + 42; } |
59 | ComboBox {} |
60 | |
61 | in-out property <int> Err; |
62 | animate Err { duration: 45s; } |
63 | |
64 | out property <bool> test: slint.slint.value == "foobar" ; |
65 | |
66 | |
67 | |
68 | } |
69 | /* |
70 | ```cpp |
71 | auto handle = TestCase::create(); |
72 | const TestCase &instance = *handle; |
73 | assert_eq(instance.get_test(), true); |
74 | ``` |
75 | |
76 | ```rust |
77 | let instance = TestCase::new().unwrap(); |
78 | assert_eq!(instance.get_test(), true); |
79 | ``` |
80 | |
81 | ```js |
82 | var instance = new slint.TestCase({}); |
83 | assert.equal(instance.test, true); |
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_eq!(instance.get_test(), true); |
93 | Ok(()) |
94 | } |