1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/issues"# ] |
2 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
3 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
4 | |
5 | export component TestCase { |
6 | VerticalLayout { |
7 | t := Text { |
8 | text: "Hello World" ; |
9 | } |
10 | } |
11 | out property <int> t-width: t.width / 1px; |
12 | } |
13 | |
14 | /* |
15 | ```rust |
16 | let instance = TestCase::new().unwrap(); |
17 | instance.window().set_size(slint::PhysicalSize::new(300, 500)); |
18 | assert_eq!(instance.get_t_width(), 300); |
19 | |
20 | ``` |
21 | |
22 | ```cpp |
23 | auto handle = TestCase::create(); |
24 | const TestCase &instance = *handle; |
25 | instance.window().set_size(slint::PhysicalSize({300, 500})); |
26 | assert_eq(instance.get_t_width(), 300); |
27 | ``` |
28 | */ |
29 | } |
30 | |
31 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
32 | use i_slint_backend_testing as slint_testing; |
33 | slint_testing::init(); |
34 | let instance = TestCase::new().unwrap(); |
35 | instance.window().set_size(slint::PhysicalSize::new(width:300, height:500)); |
36 | assert_eq!(instance.get_t_width(), 300); |
37 | |
38 | Ok(()) |
39 | } |