1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/globals"#]
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 global MyGlobal {
6 in-out property <bool> foo: false;
7 in-out property <bool> foo2;
8}
9
10export component TestCase inherits Window {
11 width: 600px;
12 height: 400px;
13
14 in-out property <bool> test: MyGlobal.foo == false && MyGlobal.foo2 == false;
15
16 r := Rectangle {
17 // This two-way binding causes MyGlobal.foo to be true
18 visible <=> MyGlobal.foo;
19 }
20
21 r2 := Rectangle {
22 // This two-way binding causes MyGlobal.foo to be true
23 visible <=> MyGlobal.foo2;
24 }
25
26}
27
28/*
29
30```rust
31let instance = TestCase::new().unwrap();
32assert_eq!(instance.get_test(), true);
33```
34
35```cpp
36auto handle = TestCase::create();
37const TestCase &instance = *handle;
38assert_eq(instance.get_test(), true);
39```
40
41*/}
42
43#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
44 use i_slint_backend_testing as slint_testing;
45 slint_testing::init();
46 let instance = TestCase::new().unwrap();
47 assert_eq!(instance.get_test(), true);
48 Ok(())
49}