Skip to content

Commit fa78179

Browse files
dfaure-kdabogoffart
authored andcommitted
layout tests: add missing compiler-based tests
Those were interpreter-only tests, better check the compiled case too.
1 parent 188f940 commit fa78179

File tree

5 files changed

+81
-3
lines changed

5 files changed

+81
-3
lines changed

tests/cases/layout/grid_span.slint

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,22 @@ export component TestCase inherits Window {
5555
rb.width == 40phx && rg.width == 20phx && rg.height == (400phx - 200phx - 100phx - 20phx) / 2 && rg.colspan == 1 &&
5656
zero.height == 0 && zero.width == rb.width && zero.x == rb.x && zero.y == rg.y &&
5757
zero2.height == rg.height && zero2.width == 0 && zero2.x > rb.x && zero2.y == rg.y && zero2.rowspan == 1 && zero2.colspan == 0
58-
5958
}
6059

6160
}
61+
62+
/*
63+
64+
```cpp
65+
auto handle = TestCase::create();
66+
const TestCase &instance = *handle;
67+
assert(instance.get_test());
68+
```
69+
70+
71+
```rust
72+
let instance = TestCase::new().unwrap();
73+
assert!(instance.get_test());
74+
```
75+
76+
*/

tests/cases/layout/issue6285_auto_explicit_restrictions.slint

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export component Bug6315 {
5050
}
5151

5252

53-
export component W inherits Window {
53+
export component TestCase inherits Window {
5454

5555
Rectangle {
5656
VerticalLayout {
@@ -69,4 +69,20 @@ export component W inherits Window {
6969
out property <bool> test: c1.min-height == 300px && c1.min-width == 200px
7070
&& c2.min-height == 300px && c2.min-width == 200px
7171
&& bug-6315.ok;
72-
}
72+
}
73+
74+
/*
75+
76+
```cpp
77+
auto handle = TestCase::create();
78+
const TestCase &instance = *handle;
79+
assert(instance.get_test());
80+
```
81+
82+
83+
```rust
84+
let instance = TestCase::new().unwrap();
85+
assert!(instance.get_test());
86+
```
87+
88+
*/

tests/cases/layout/opacity_in_layout.slint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,18 @@ export TestCase := Window {
3838
property <length> layout4_width : layout4.preferred-width;
3939
property<bool> test: layout1_height == 55px && layout2_width == 88px && layout3_width == 30px && layout4_width == 30px;
4040
}
41+
42+
/*
43+
44+
```cpp
45+
auto handle = TestCase::create();
46+
const TestCase &instance = *handle;
47+
assert(instance.get_test());
48+
```
49+
50+
51+
```rust
52+
let instance = TestCase::new().unwrap();
53+
assert!(instance.get_test());
54+
```
55+
*/

tests/cases/layout/override_from_parent.slint

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,19 @@ TestCase := Rectangle {
3838
sc4 := SubComp4 {}
3939
property<bool> test: sc1.min-width == 200px && sc2.min-width == 200px && sc3.max-width == 200px && sc4.min-width == 200px;
4040
}
41+
42+
/*
43+
44+
```cpp
45+
auto handle = TestCase::create();
46+
const TestCase &instance = *handle;
47+
assert(instance.get_test());
48+
```
49+
50+
51+
```rust
52+
let instance = TestCase::new().unwrap();
53+
assert!(instance.get_test());
54+
```
55+
*/
56+

tests/cases/layout/text_no_wrap.slint

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ TestCase := Rectangle {
2121

2222
property <bool> test: square.width == square.height;
2323
}
24+
25+
/*
26+
27+
```cpp
28+
auto handle = TestCase::create();
29+
const TestCase &instance = *handle;
30+
assert(instance.get_test());
31+
```
32+
33+
34+
```rust
35+
let instance = TestCase::new().unwrap();
36+
assert!(instance.get_test());
37+
```
38+
39+
*/

0 commit comments

Comments
 (0)