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
8import { Button, ComboBox } from "std-widgets.slint";
9
10export struct Some {}
11export struct None { s: Some }
12export struct Option { n: None }
13export struct Component {o: Option }
14export struct Model { c: Component }
15export struct Result { m: Model }
16export struct Ok { r: Result }
17export struct Property { value: string }
18export struct PropertyAnimation { property: Property }
19export struct Callback {}
20export struct Rc {}
21export struct Weak {}
22export enum WindowAdaptor { Window }
23export struct WindowItem {}
24export struct Slint { slint: string }
25export struct LayoutInfo { layout: int }
26export struct BoxLayoutData { layout: length }
27
28
29
30export enum Slice { xxx }
31export enum Coord { xxx }
32//export enum vtable { a, b, c }
33export struct AccessibleRole { value: Coord }
34export enum Default { a, b, c }
35
36
37export global ComponentInstance {
38 out property <Ok> ok;
39}
40
41export global GridLayoutCellData {
42 callback begin;
43}
44
45export component SharedString {
46 out property <Property> slint: { value: "foobar" };
47 property ok <=> ComponentInstance.ok;
48}
49
50export global ItemVTable {}
51
52export 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
71auto handle = TestCase::create();
72const TestCase &instance = *handle;
73assert_eq(instance.get_test(), true);
74```
75
76```rust
77let instance = TestCase::new().unwrap();
78assert_eq!(instance.get_test(), true);
79```
80
81```js
82var instance = new slint.TestCase({});
83assert.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}