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
4export global ScreenHistory {
5 public function restore() {
6 CurrentDisplayedScreen.set_without_history();
7 }
8
9 out property<bool> test: false;
10 out property<bool> test2: CurrentDisplayedScreen.test;
11
12 public function append_screen() {
13 test = true;
14 }
15}
16
17export global CurrentDisplayedScreen {
18 public function set() {
19 ScreenHistory.append_screen();
20 }
21
22 out property<bool> test: false;
23 out property<bool> test2: ScreenHistory.test;
24
25 public function set_without_history() {
26 test = true;
27 }
28}
29
30export component TestCase inherits Window {
31 init => {
32 CurrentDisplayedScreen.set();
33 ScreenHistory.restore();
34 }
35 out property <bool> test: ScreenHistory.test2 && CurrentDisplayedScreen.test2;
36}
37
38
39/*
40
41```cpp
42auto handle = TestCase::create();
43const TestCase &instance = *handle;
44assert(instance.get_test());
45```
46
47```rust
48let instance = TestCase::new().unwrap();
49assert!(instance.get_test());
50
51```
52
53```js
54var instance = new slint.TestCase({});
55assert(instance.test);
56```
57
58
59
60*/
61