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