1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/examples"#]
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
5import { Button } from "std-widgets.slint";
6
7// Test case for manual visual verification that layering does not pessimize the
8// output, and to have a compile-time verification that the lowering to the Layer
9// element compiles.
10
11MyLayer := Rectangle {
12 cache-rendering-hint: true;
13 background: red;
14 for i in 1000: Rectangle {
15 cache-rendering-hint: i == 8;
16 background: blue;
17 drop-shadow-blur: 10px;
18 drop-shadow-offset-x: 5px;
19 drop-shadow-offset-y: 5px;
20 drop-shadow-color: green;
21 Text {
22 text: "Many text items over each other";
23 }
24 }
25}
26
27export TestCase := Window {
28 preferred-width: 800px;
29 preferred-height: 600px;
30 background: white;
31
32 VerticalLayout {
33
34 Button {
35 text: "Press me to start the animation and check that it is smooth.";
36 clicked => {
37 layered.place_to_the_right = true;
38 }
39 }
40
41 Rectangle {
42
43 // This will be a layer
44 layered := MyLayer {
45 width: 200px;
46 height: 100px;
47
48 property <bool> place_to_the_right;
49 states [
50 right when place_to_the_right: {
51 x: 200px;
52 }
53 left when !place_to_the_right: {
54 x: 10px;
55 }
56 ]
57
58 animate x {
59 duration: 15s;
60 }
61 }
62 }
63 }
64}
65}
66