1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/layout"# ] |
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 | TestCase := Rectangle { |
6 | background: green; |
7 | width: 300phx; |
8 | height: 50phx; |
9 | |
10 | HorizontalLayout { |
11 | padding: 0px; |
12 | fake-image := Rectangle { |
13 | background: blue; |
14 | preferred-width: 25phx; |
15 | // Don't apply the preferred height for the horizontal layout. |
16 | preferred-height: 500phx; |
17 | horizontal-stretch: 0; |
18 | vertical-stretch: 0; |
19 | } |
20 | Rectangle { |
21 | background: green; |
22 | // implicit: horizontal-stretch: 1 |
23 | } |
24 | } |
25 | |
26 | property <bool> fake-image-width-ok: fake-image.width == 25phx; |
27 | property <bool> fake-image-height-ok: fake-image.height == 50phx; |
28 | } |
29 | |
30 | /* |
31 | |
32 | ```cpp |
33 | auto handle = TestCase::create(); |
34 | const TestCase &instance = *handle; |
35 | assert(instance.get_fake_image_width_ok()); |
36 | assert(instance.get_fake_image_height_ok()); |
37 | ``` |
38 | |
39 | |
40 | ```rust |
41 | let instance = TestCase::new().unwrap(); |
42 | assert!(instance.get_fake_image_width_ok()); |
43 | assert!(instance.get_fake_image_height_ok()); |
44 | ``` |
45 | |
46 | ```js |
47 | var instance = new slint.TestCase(); |
48 | slintlib.private_api.send_mouse_click(instance, 5., 5.); |
49 | assert(instance.fake_image_width_ok); |
50 | assert(instance.fake_image_height_ok); |
51 | ``` |
52 | |
53 | */ |
54 | } |
55 | |
56 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
57 | use i_slint_backend_testing as slint_testing; |
58 | slint_testing::init(); |
59 | let instance = TestCase::new().unwrap(); |
60 | assert!(instance.get_fake_image_width_ok()); |
61 | assert!(instance.get_fake_image_height_ok()); |
62 | Ok(()) |
63 | } |