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