1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/imports/../../helper_components"# ] |
2 | #[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/imports"# ] |
3 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
4 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
5 | |
6 | //include_path: ../../helper_components |
7 | import { UseGlobal, ExportedGlobal as FromExport } from "export_globals.slint" ; |
8 | |
9 | global NotExported := { |
10 | property<int> abc: 1000; |
11 | property<string> prop: "_" ; |
12 | } |
13 | |
14 | global ExportedGlobal := { |
15 | property<int> abc: 1001; |
16 | } |
17 | |
18 | TestCase := Rectangle { |
19 | ug := UseGlobal {} |
20 | property<int> p1: ug.used42; |
21 | property<int> p2: ug.used44; |
22 | property<int> p3: NotExported.abc + ExportedGlobal.abc; |
23 | |
24 | property <bool> test: p1 == 42 && p2 == 44 && p3 == 2001 ;//&& NotExported.prop == "_"; |
25 | } |
26 | /* |
27 | |
28 | ```cpp |
29 | auto handle = TestCase::create(); |
30 | const TestCase &instance = *handle; |
31 | assert_eq(instance.get_p1(), 42); |
32 | assert_eq(instance.get_p2(), 44); |
33 | assert_eq(instance.get_p3(), 2001); |
34 | ``` |
35 | |
36 | ```rust |
37 | let instance = TestCase::new().unwrap(); |
38 | assert_eq!(instance.get_p1(), 42); |
39 | assert_eq!(instance.get_p2(), 44); |
40 | assert_eq!(instance.get_p3(), 2001); |
41 | ``` |
42 | |
43 | ```js |
44 | var instance = new slint.TestCase({}); |
45 | assert.equal(instance.p1, 42); |
46 | assert.equal(instance.p2, 44); |
47 | assert.equal(instance.p3, 2001); |
48 | ``` |
49 | |
50 | */ |
51 | } |
52 | |
53 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
54 | use i_slint_backend_testing as slint_testing; |
55 | slint_testing::init(); |
56 | let instance = TestCase::new().unwrap(); |
57 | assert_eq!(instance.get_p1(), 42); |
58 | assert_eq!(instance.get_p2(), 44); |
59 | assert_eq!(instance.get_p3(), 2001); |
60 | Ok(()) |
61 | } |