aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/scenegraph_lancelot
diff options
context:
space:
mode:
authorJonas Karlsson <jonas.karlsson@qt.io>2020-06-23 13:25:39 +0200
committerJonas Karlsson <jonas.karlsson@qt.io>2020-06-29 15:24:12 +0200
commitbd1c28a82c2ff955e0d154fac2e2df8d5a110dd7 (patch)
tree499f56b6a1d39f7ceb202b53a3f8a4d0bd530eb9 /tests/manual/scenegraph_lancelot
parenta059aa2e2812fab98dc11da73a6241ba6937dce1 (diff)
Reimplement UniformAnimator for ShaderEffect
Fixes: QTBUG-83976 Change-Id: I307e96be0d3d2edeb8d9065d100c1ef38c8824c7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests/manual/scenegraph_lancelot')
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/propertyanimation/uniformanimator_stall.qml52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/propertyanimation/uniformanimator_stall.qml b/tests/manual/scenegraph_lancelot/data/shaders/propertyanimation/uniformanimator_stall.qml
new file mode 100644
index 0000000000..e62c64e3ae
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/propertyanimation/uniformanimator_stall.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.12
+
+// This test is a rotating rectangle with a uniform animator changing its color.
+// There is a timer interrupting the rotation, but the uniform animator will still
+// run. This is repeated a few times and then all animation is stopped.
+
+Item {
+ width: 320
+ height: 320
+ visible: true
+
+ function stall(milliseconds) {
+ var startTime = new Date().getTime();
+ while ((new Date().getTime()) - startTime < milliseconds) {}
+ }
+
+ ShaderEffect {
+ id: shader
+ x: 60
+ y: 60
+ width: 200
+ height: 200
+ property real colorProperty: 0.0
+ fragmentShader: "qrc:shaders/property.frag"
+ UniformAnimator {
+ id: animator
+ target: shader
+ uniform: "colorProperty"
+ duration: 950
+ from: 0.0
+ to: 1.0
+ loops: 10
+ running: true
+ }
+ NumberAnimation on rotation { from: 0;to: 360; duration: 2500; loops: 1 }
+ }
+
+ Timer {
+ interval: 600; running: true; repeat: true;
+ property int num_repeats: 0
+ onTriggered: {
+ if (num_repeats < 3) {
+ stall(550);
+ } else {
+ animator.running = false;
+ repeat = false;
+ }
+
+ num_repeats += 1;
+ }
+ }
+}