1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4// Issue 7887
5
6export global G {
7 in-out property <string> r;
8}
9
10component MyLayout inherits HorizontalLayout {
11 Rectangle {
12 width: 20phx;
13 background: red;
14 }
15
16 Timer {
17 interval: 1s;
18 triggered => {
19 G.r += "a";
20 }
21 }
22
23 PopupWindow { }
24
25 Timer {
26 interval: 1.3s;
27 triggered => {
28 G.r += "b";
29 }
30 }
31
32 @children
33
34 Timer {
35 interval: 1.6s;
36 triggered => {
37 G.r += "c";
38 }
39 }
40
41 Rectangle {
42 width: 10phx;
43 background: red;
44 }
45}
46
47export component TestCase inherits Window {
48 width: 300phx;
49 height: 200phx;
50
51 MyLayout {
52 rect1 := Rectangle {
53 background: black;
54 }
55 }
56
57 out property xx <=> rect1.x;
58 out property ww <=> rect1.width;
59
60 out property <bool> rect1_pos_ok: rect1.x == 20phx && rect1.width == 300phx - 30phx;
61 out property <bool> test: rect1_pos_ok;
62}
63/*
64```cpp
65auto handle = TestCase::create();
66const TestCase &instance = *handle;
67assert(instance.get_test());
68
69slint_testing::mock_elapsed_time(1900);
70assert_eq(instance.global<G>().get_r(), "abc");
71```
72
73
74```rust
75let instance = TestCase::new().unwrap();
76assert!(instance.get_test());
77
78slint_testing::mock_elapsed_time(1900);
79assert_eq!(instance.global::<G<'_>>().get_r(), "abc");
80```
81*/
82