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
5global Glob := {
6 property <int> a_alias <=> a;
7 property <int> a: 3;
8 property <int> b: a + 3;
9
10}
11
12TestCase := Rectangle {
13 callback set_a(int);
14 set_a(a) => { Glob.a_alias = a; }
15 property <int> value1: Glob.b;
16 property <bool> test: value1 == 3+3;
17}
18
19/*
20```rust
21let instance = TestCase::new().unwrap();
22assert_eq!(instance.get_value1(), 3+3);
23instance.invoke_set_a(4);
24assert_eq!(instance.get_value1(), 4+3);
25```
26
27```cpp
28auto handle = TestCase::create();
29const TestCase &instance = *handle;
30assert_eq(instance.get_value1(), 3+3);
31instance.invoke_set_a(4);
32assert_eq(instance.get_value1(), 4+3);
33```
34
35```js
36let instance = new slint.TestCase({});
37assert.equal(instance.value1, 3+3);
38instance.set_a(4);
39assert.equal(instance.value1, 4+3);
40```
41
42*/
43}
44
45#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
46 use i_slint_backend_testing as slint_testing;
47 slint_testing::init();
48 let instance = TestCase::new().unwrap();
49 assert_eq!(instance.get_value1(), 3+3);
50 instance.invoke_set_a(4);
51 assert_eq!(instance.get_value1(), 4+3);
52 Ok(())
53}