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// This tests that constant property from global are properly initialized
6
7global Glob := {
8 property <int> a: 3;
9 property <int> b: a + 3;
10}
11
12global Glob2 := {
13 property <int> a: other;
14 property <int> other: 5;
15}
16
17TestCase := Rectangle {
18 r := Rectangle {
19 property <int> value1: Glob.b;
20 property <int> value2: true ? Glob2.a : 88;
21 }
22 property <bool> test: r.value1 + r.value2 == 3+3 +5;
23}
24
25/*
26```rust
27let instance = TestCase::new().unwrap();
28assert!(instance.get_test());
29```
30
31```cpp
32auto handle = TestCase::create();
33const TestCase &instance = *handle;
34assert(instance.get_test());
35```
36
37```js
38let instance = new slint.TestCase({});
39assert(instance.test);
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!(instance.get_test());
50 Ok(())
51}