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// Test that the default geometry is taken from the right parent, even when some
6//of visible or opacity or so are set
7
8export component TestCase {
9 in property <bool> condition: true;
10 Rectangle {
11 width: 10px;
12 height: 20px;
13
14 invisible := Rectangle {
15 visible: condition;
16 background: blue;
17 }
18
19 opaque := Rectangle {
20 opacity: 0.5;
21 background: red;
22 }
23
24 clipped := Rectangle {
25 clip: condition;
26 background: yellow;
27 }
28
29 shadowed := Rectangle {
30 drop-shadow-color: #00000054;
31 drop-shadow-blur: 8px;
32 background: pink;
33 }
34
35 all := Rectangle {
36 visible: condition;
37 clip: condition;
38 opacity: 0.2;
39 drop-shadow-color: #00000054;
40 drop-shadow-blur: 8px;
41 background: orange;
42 }
43
44 }
45
46 out property <bool> test:
47 invisible.width == 10px && invisible.height == 20px &&
48 opaque.width == 10px && opaque.height == 20px &&
49 clipped.width == 10px && clipped.height == 20px &&
50 shadowed.width == 10px && shadowed.height == 20px &&
51 all.width == 10px && all.height == 20px;
52}
53
54/*
55```cpp
56auto handle = TestCase::create();
57const TestCase &instance = *handle;
58assert(instance.get_test());
59```
60
61
62```rust
63let instance = TestCase::new().unwrap();
64assert!(instance.get_test());
65```
66
67```js
68var instance = new slint.TestCase({});
69assert(instance.test);
70```
71*/
72}
73
74#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
75 use i_slint_backend_testing as slint_testing;
76 slint_testing::init();
77 let instance = TestCase::new().unwrap();
78 assert!(instance.get_test());
79 Ok(())
80}