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 { UseStruct , ExportedStruct, ExportEnum } from "export_structs.slint" ; |
8 | TestCase := Rectangle { |
9 | property <ExportedStruct> exp: { d: 3001, e: {a: 2001} }; |
10 | u := UseStruct { |
11 | exp: { d: 3002, e: {a: 2002} }; |
12 | nexp: { b: 3003, c: {a: 2003} }; |
13 | } |
14 | out property<bool> xx: ExportEnum.Hello != ExportEnum.Bonjour; |
15 | property<int> p1: u.nexp.c.a; |
16 | } |
17 | /* |
18 | |
19 | ```cpp |
20 | auto handle = TestCase::create(); |
21 | const TestCase &instance = *handle; |
22 | assert_eq(instance.get_p1(), 2003); |
23 | assert_eq(instance.get_exp().e.a, 2001); |
24 | ``` |
25 | |
26 | ```rust |
27 | let instance = TestCase::new().unwrap(); |
28 | assert_eq!(instance.get_p1(), 2003); |
29 | assert_eq!(instance.get_exp().e.a, 2001); |
30 | ``` |
31 | |
32 | ```js |
33 | var instance = new slint.TestCase({}); |
34 | assert.equal(instance.p1, 2003); |
35 | assert.equal(instance.exp.e.a, 2001); |
36 | ``` |
37 | |
38 | */ |
39 | } |
40 | |
41 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
42 | use i_slint_backend_testing as slint_testing; |
43 | slint_testing::init(); |
44 | let instance = TestCase::new().unwrap(); |
45 | assert_eq!(instance.get_p1(), 2003); |
46 | assert_eq!(instance.get_exp().e.a, 2001); |
47 | Ok(()) |
48 | } |