| 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 | //include_path: ../../helper_components |
| 5 | import { |
| 6 | UseGlobal, |
| 7 | ExportedGlobal as FromExport, |
| 8 | } from "export_globals.slint" ; |
| 9 | |
| 10 | global NotExported := { |
| 11 | property<int> abc: 1000; |
| 12 | property<string> prop: "_" ; |
| 13 | } |
| 14 | |
| 15 | global ExportedGlobal := { |
| 16 | property<int> abc: 1001; |
| 17 | } |
| 18 | |
| 19 | TestCase := Rectangle { |
| 20 | ug := UseGlobal {} |
| 21 | property<int> p1: ug.used42; |
| 22 | property<int> p2: ug.used44; |
| 23 | property<int> p3: NotExported.abc + ExportedGlobal.abc; |
| 24 | |
| 25 | property <bool> test: p1 == 42 && p2 == 44 && p3 == 2001 ;//&& NotExported.prop == "_"; |
| 26 | } |
| 27 | /* |
| 28 | |
| 29 | ```cpp |
| 30 | auto handle = TestCase::create(); |
| 31 | const TestCase &instance = *handle; |
| 32 | assert_eq(instance.get_p1(), 42); |
| 33 | assert_eq(instance.get_p2(), 44); |
| 34 | assert_eq(instance.get_p3(), 2001); |
| 35 | ``` |
| 36 | |
| 37 | ```rust |
| 38 | let instance = TestCase::new().unwrap(); |
| 39 | assert_eq!(instance.get_p1(), 42); |
| 40 | assert_eq!(instance.get_p2(), 44); |
| 41 | assert_eq!(instance.get_p3(), 2001); |
| 42 | ``` |
| 43 | |
| 44 | ```js |
| 45 | var instance = new slint.TestCase({}); |
| 46 | assert.equal(instance.p1, 42); |
| 47 | assert.equal(instance.p2, 44); |
| 48 | assert.equal(instance.p3, 2001); |
| 49 | ``` |
| 50 | |
| 51 | */ |
| 52 | |