| 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 | export 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 | |
| 17 | export 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 | |
| 30 | export 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 |
| 42 | auto handle = TestCase::create(); |
| 43 | const TestCase &instance = *handle; |
| 44 | assert(instance.get_test()); |
| 45 | ``` |
| 46 | |
| 47 | ```rust |
| 48 | let instance = TestCase::new().unwrap(); |
| 49 | assert!(instance.get_test()); |
| 50 | |
| 51 | ``` |
| 52 | |
| 53 | ```js |
| 54 | var instance = new slint.TestCase({}); |
| 55 | assert(instance.test); |
| 56 | ``` |
| 57 | |
| 58 | |
| 59 | |
| 60 | */ |
| 61 | |