1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4InheritFlickable := Flickable {}
5
6TestCase := Window {
7 width: 500phx;
8 height: 500phx;
9
10 Flickable {
11 r1 := Rectangle {
12 property<bool> ok: height == root.height && width == root.width;
13 }
14 }
15
16 InheritFlickable {
17 width: 123phx;
18 viewport_height: 456phx;
19 r2 := Rectangle {
20 property<bool> ok: height == 456phx && width == 123phx;
21 }
22 }
23
24 f3 := InheritFlickable {
25 VerticalLayout {
26 spacing: 0phx;
27 padding: 0phx;
28 r3 := Rectangle {
29 property<bool> ok: height == root.height/2 && width == 888phx && f3.viewport_width == 888phx && f3.min-width == 0phx;
30 }
31 Rectangle {
32 min-width: 888phx;
33 }
34 }
35 }
36
37 f4 := Flickable {
38 HorizontalLayout {
39 spacing: 0phx;
40 padding: 0phx;
41 r4 := Rectangle {
42 property<bool> ok: f4.max-height == 6000phx && r4.height == root.height;
43 }
44 Rectangle {
45 max-height: 6000phx;
46 }
47 }
48 }
49
50 Flickable { for i in 5: Rectangle {} }
51
52 property<bool> all_ok: r1.ok && r2.ok && r3.ok && r4.ok;
53 property<bool> test: all_ok;
54}
55
56/*
57```cpp
58auto handle = TestCase::create();
59const TestCase &instance = *handle;
60slint_testing::send_mouse_click(&instance, 5., 5.);
61
62assert(instance.get_all_ok());
63```
64
65
66```rust
67let instance = TestCase::new().unwrap();
68slint_testing::send_mouse_click(&instance, 5., 5.);
69assert!(instance.get_all_ok());
70```
71
72```js
73var instance = new slint.TestCase();
74slintlib.private_api.send_mouse_click(instance, 5., 5.);
75assert(instance.all_ok);
76```
77*/
78