aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-09-24 12:51:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 20:08:19 +0200
commit0150202cc710e580695656fee049bf25091c0ded (patch)
tree217f5fbf792b5d40baeea0916064bb0ac2050b84 /tests
parentc40d9f64a6bd9671edc807bc74cf5b73c7465250 (diff)
Allow animators to work properly with multiple windows
Change-Id: I5ba663ba0fa089ea786cf43cb4dfa40cbc955342 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/animators/Box.qml (renamed from tests/auto/quick/qquickanimators/data/Box.qml)0
-rw-r--r--tests/auto/qmltest/animators/tst_behavior.qml (renamed from tests/auto/quick/qquickanimators/data/tst_behavior.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_mixedparallel.qml (renamed from tests/auto/quick/qquickanimators/data/tst_mixedparallel.qml)6
-rw-r--r--tests/auto/qmltest/animators/tst_mixedsequential.qml (renamed from tests/auto/quick/qquickanimators/data/tst_mixedsequential.qml)6
-rw-r--r--tests/auto/qmltest/animators/tst_nested.qml (renamed from tests/auto/quick/qquickanimators/data/tst_nested.qml)16
-rw-r--r--tests/auto/qmltest/animators/tst_on.qml (renamed from tests/auto/quick/qquickanimators/data/tst_on.qml)12
-rw-r--r--tests/auto/qmltest/animators/tst_opacity.qml (renamed from tests/auto/quick/qquickanimators/data/tst_opacity.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_parallel.qml (renamed from tests/auto/quick/qquickanimators/data/tst_parallel.qml)6
-rw-r--r--tests/auto/qmltest/animators/tst_restart.qml (renamed from tests/auto/quick/qquickanimators/data/tst_restart.qml)2
-rw-r--r--tests/auto/qmltest/animators/tst_rotation.qml (renamed from tests/auto/quick/qquickanimators/data/tst_rotation.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_scale.qml (renamed from tests/auto/quick/qquickanimators/data/tst_scale.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_sequential.qml (renamed from tests/auto/quick/qquickanimators/data/tst_sequential.qml)6
-rw-r--r--tests/auto/qmltest/animators/tst_transformorigin.qml (renamed from tests/auto/quick/qquickanimators/data/tst_transformorigin.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_transition.qml (renamed from tests/auto/quick/qquickanimators/data/tst_transition.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_x.qml (renamed from tests/auto/quick/qquickanimators/data/tst_x.qml)4
-rw-r--r--tests/auto/qmltest/animators/tst_y.qml (renamed from tests/auto/quick/qquickanimators/data/tst_y.qml)4
-rw-r--r--tests/auto/quick/qquickanimators/data/windowWithAnimator.qml68
-rw-r--r--tests/auto/quick/qquickanimators/qquickanimators.pro14
-rw-r--r--tests/auto/quick/qquickanimators/tst_qquickanimators.cpp73
19 files changed, 185 insertions, 56 deletions
diff --git a/tests/auto/quick/qquickanimators/data/Box.qml b/tests/auto/qmltest/animators/Box.qml
index cff3e7f929..cff3e7f929 100644
--- a/tests/auto/quick/qquickanimators/data/Box.qml
+++ b/tests/auto/qmltest/animators/Box.qml
diff --git a/tests/auto/quick/qquickanimators/data/tst_behavior.qml b/tests/auto/qmltest/animators/tst_behavior.qml
index b22cc93b09..dfcbcd0620 100644
--- a/tests/auto/quick/qquickanimators/data/tst_behavior.qml
+++ b/tests/auto/qmltest/animators/tst_behavior.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "behavior"
+ name: "animators-behavior"
when: box.scale == 2
function test_endresult() {
compare(box.scaleChangeCounter, 1);
@@ -62,7 +62,7 @@ Item {
Box {
id: box
- Behavior on scale { ScaleAnimator { id: animation; duration: 300; } }
+ Behavior on scale { ScaleAnimator { id: animation; duration: 100; } }
}
Timer {
diff --git a/tests/auto/quick/qquickanimators/data/tst_mixedparallel.qml b/tests/auto/qmltest/animators/tst_mixedparallel.qml
index 9cd28f2493..863affec7b 100644
--- a/tests/auto/quick/qquickanimators/data/tst_mixedparallel.qml
+++ b/tests/auto/qmltest/animators/tst_mixedparallel.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "mixedparallel"
+ name: "animators-mixedparallel"
when: !animation.running
function test_endresult() {
compare(box.rotationChangeCounter, 1);
@@ -65,8 +65,8 @@ Item {
id: box
ParallelAnimation {
id: animation
- NumberAnimation { target: box; property: "scale"; from: 1; to: 2.0; duration: 1000; }
- RotationAnimator { target: box; from: 0; to: 180; duration: 1000; }
+ NumberAnimation { target: box; property: "scale"; from: 1; to: 2.0; duration: 100; }
+ RotationAnimator { target: box; from: 0; to: 180; duration: 100; }
running: true
loops: 1;
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_mixedsequential.qml b/tests/auto/qmltest/animators/tst_mixedsequential.qml
index 4c62bc8018..e514f2c4ab 100644
--- a/tests/auto/quick/qquickanimators/data/tst_mixedsequential.qml
+++ b/tests/auto/qmltest/animators/tst_mixedsequential.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "mixedsequential"
+ name: "animators-mixedsequential"
when: !animation.running
function test_endresult() {
compare(box.rotationChangeCounter, 1);
@@ -65,8 +65,8 @@ Item {
id: box
ParallelAnimation {
id: animation
- NumberAnimation { target: box; property: "scale"; from: 1; to: 2.0; duration: 500; }
- RotationAnimator { target: box; from: 0; to: 180; duration: 500; }
+ NumberAnimation { target: box; property: "scale"; from: 1; to: 2.0; duration: 100; }
+ RotationAnimator { target: box; from: 0; to: 180; duration: 100; }
running: true
loops: 1;
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_nested.qml b/tests/auto/qmltest/animators/tst_nested.qml
index 95cb70cb48..b936a88124 100644
--- a/tests/auto/quick/qquickanimators/data/tst_nested.qml
+++ b/tests/auto/qmltest/animators/tst_nested.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "nested"
+ name: "animators-nested"
when: !animation.running
function test_endresult() {
compare(box.before, 2);
@@ -69,18 +69,18 @@ Item {
id: animation;
ScriptAction { script: box.before++; }
ParallelAnimation {
- ScaleAnimator { target: box; from: 2.0; to: 1; duration: 500; }
- OpacityAnimator { target: box; from: 0; to: 1; duration: 500; }
+ ScaleAnimator { target: box; from: 2.0; to: 1; duration: 100; }
+ OpacityAnimator { target: box; from: 0; to: 1; duration: 100; }
}
- PauseAnimation { duration: 500 }
+ PauseAnimation { duration: 100 }
SequentialAnimation {
ParallelAnimation {
- XAnimator { target: box; from: 0; to: 100; duration: 500}
- RotationAnimator { target: box; from: 0; to: 90; duration: 500 }
+ XAnimator { target: box; from: 0; to: 100; duration: 100 }
+ RotationAnimator { target: box; from: 0; to: 90; duration: 100 }
}
ParallelAnimation {
- XAnimator { target: box; from: 100; to: 0; duration: 500 }
- RotationAnimator { target: box; from: 90; to: 0; duration: 500 }
+ XAnimator { target: box; from: 100; to: 0; duration: 100 }
+ RotationAnimator { target: box; from: 90; to: 0; duration: 100 }
}
}
ScriptAction { script: box.after++; }
diff --git a/tests/auto/quick/qquickanimators/data/tst_on.qml b/tests/auto/qmltest/animators/tst_on.qml
index e48d7107f9..7930dc5be3 100644
--- a/tests/auto/quick/qquickanimators/data/tst_on.qml
+++ b/tests/auto/qmltest/animators/tst_on.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "on"
+ name: "animators-on"
when: !animx.running && !animy.running
&& !anims.running && !animr.running
&& !animo.running;
@@ -70,10 +70,10 @@ Item {
Box {
id: box
anchors.centerIn: undefined
- XAnimator on x { id: animx; from: 0; to: 100; duration: 1000 }
- YAnimator on y { id: animy; from: 0; to: 100; duration: 1000 }
- ScaleAnimator on scale { id: anims; from: 1; to: 2; duration: 1000 }
- RotationAnimator on rotation { id: animr ; from: 0; to: 180; duration: 1000 }
- OpacityAnimator on opacity { id: animo; from: 1; to: 0.5; duration: 1000 }
+ XAnimator on x { id: animx; from: 0; to: 100; duration: 100 }
+ YAnimator on y { id: animy; from: 0; to: 100; duration: 100 }
+ ScaleAnimator on scale { id: anims; from: 1; to: 2; duration: 100 }
+ RotationAnimator on rotation { id: animr ; from: 0; to: 180; duration: 100 }
+ OpacityAnimator on opacity { id: animo; from: 1; to: 0.5; duration: 100 }
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_opacity.qml b/tests/auto/qmltest/animators/tst_opacity.qml
index a785b2b3f3..eba1659cc4 100644
--- a/tests/auto/quick/qquickanimators/data/tst_opacity.qml
+++ b/tests/auto/qmltest/animators/tst_opacity.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "opacity"
+ name: "animators-opacity"
when: !animation.running
function test_endresult() {
compare(box.opacityChangeCounter, 1);
@@ -69,7 +69,7 @@ Item {
target: box
from: 1;
to: 0.5
- duration: 1000
+ duration: 100
running: true
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_parallel.qml b/tests/auto/qmltest/animators/tst_parallel.qml
index 3105d3c2dd..8fde73804f 100644
--- a/tests/auto/quick/qquickanimators/data/tst_parallel.qml
+++ b/tests/auto/qmltest/animators/tst_parallel.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "parallel"
+ name: "animators-parallel"
when: !animation.running
function test_endresult() {
compare(box.rotationChangeCounter, 1);
@@ -66,8 +66,8 @@ Item {
id: box
ParallelAnimation {
id: animation
- ScaleAnimator { target: box; from: 1; to: 2.0; duration: 1000; }
- RotationAnimator { target: box; from: 0; to: 180; duration: 1000; }
+ ScaleAnimator { target: box; from: 1; to: 2.0; duration: 100; }
+ RotationAnimator { target: box; from: 0; to: 180; duration: 100; }
running: true
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_restart.qml b/tests/auto/qmltest/animators/tst_restart.qml
index 42c7a33a8b..588c81ade5 100644
--- a/tests/auto/quick/qquickanimators/data/tst_restart.qml
+++ b/tests/auto/qmltest/animators/tst_restart.qml
@@ -51,7 +51,7 @@ Item {
TestCase {
id: testcase
- name: "restart"
+ name: "animators-restart"
when: root.restartCount == 0 && animation.running == false;
function test_endresult() {
compare(box.scale, 2);
diff --git a/tests/auto/quick/qquickanimators/data/tst_rotation.qml b/tests/auto/qmltest/animators/tst_rotation.qml
index 517cf59456..384a3738bb 100644
--- a/tests/auto/quick/qquickanimators/data/tst_rotation.qml
+++ b/tests/auto/qmltest/animators/tst_rotation.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "rotation"
+ name: "animators-rotation"
when: !animation.running
function test_endresult() {
compare(box.rotationChangeCounter, 1);
@@ -66,7 +66,7 @@ Item {
target: box
from: 0;
to: 180
- duration: 1000
+ duration: 100
easing.type: Easing.InOutBack
running: true
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_scale.qml b/tests/auto/qmltest/animators/tst_scale.qml
index 6fd4668684..5df0cb5cea 100644
--- a/tests/auto/quick/qquickanimators/data/tst_scale.qml
+++ b/tests/auto/qmltest/animators/tst_scale.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "scale"
+ name: "animators-scale"
when: !animation.running
function test_endresult() {
compare(box.scaleChangeCounter, 1);
@@ -67,7 +67,7 @@ Item {
target: box
from: 1;
to: 2.0
- duration: 1000
+ duration: 100
easing.type: Easing.InOutCubic
running: true
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_sequential.qml b/tests/auto/qmltest/animators/tst_sequential.qml
index 2bb14f8acf..397133ea7d 100644
--- a/tests/auto/quick/qquickanimators/data/tst_sequential.qml
+++ b/tests/auto/qmltest/animators/tst_sequential.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "parallel"
+ name: "animators-parallel"
when: !animation.running
function test_endresult() {
compare(box.rotationChangeCounter, 1);
@@ -66,8 +66,8 @@ Item {
id: box
SequentialAnimation {
id: animation
- ScaleAnimator { target: box; from: 1; to: 2.0; duration: 1000; }
- RotationAnimator { target: box; from: 0; to: 180; duration: 1000; }
+ ScaleAnimator { target: box; from: 1; to: 2.0; duration: 100; }
+ RotationAnimator { target: box; from: 0; to: 180; duration: 100; }
running: true
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_transformorigin.qml b/tests/auto/qmltest/animators/tst_transformorigin.qml
index 0211d0305d..2cc57f81a2 100644
--- a/tests/auto/quick/qquickanimators/data/tst_transformorigin.qml
+++ b/tests/auto/qmltest/animators/tst_transformorigin.qml
@@ -58,7 +58,7 @@ Item {
TestCase {
id: testCase
- name: "transformorigin"
+ name: "animators-transformorigin"
when: timer.triggered
function test_endresult() {
@@ -151,7 +151,7 @@ Item {
transformOrigin: root.origins[index];
- ScaleAnimator { target: box; from: 1; to: 5.5; duration: 1000; running: true; }
+ ScaleAnimator { target: box; from: 1; to: 5.5; duration: 100; running: true; }
}
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_transition.qml b/tests/auto/qmltest/animators/tst_transition.qml
index 8e21a6537e..d2ccf600ff 100644
--- a/tests/auto/quick/qquickanimators/data/tst_transition.qml
+++ b/tests/auto/qmltest/animators/tst_transition.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testcase
- name: "transition"
+ name: "animators-transition"
when: box.scale == 2
function test_endresult() {
compare(box.scaleChangeCounter, 1);
@@ -74,7 +74,7 @@ Item {
transitions: [
Transition {
- ScaleAnimator { duration: 200; }
+ ScaleAnimator { duration: 100; }
}
]
diff --git a/tests/auto/quick/qquickanimators/data/tst_x.qml b/tests/auto/qmltest/animators/tst_x.qml
index 70ecf96346..d789b5c434 100644
--- a/tests/auto/quick/qquickanimators/data/tst_x.qml
+++ b/tests/auto/qmltest/animators/tst_x.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "x"
+ name: "animators-x"
when: !animation.running
function test_endresult() {
compare(box.xChangeCounter, 1);
@@ -70,7 +70,7 @@ Item {
target: box
from: 0;
to: 100
- duration: 1000
+ duration: 100
running: true
}
}
diff --git a/tests/auto/quick/qquickanimators/data/tst_y.qml b/tests/auto/qmltest/animators/tst_y.qml
index 428d42a6c3..a595023919 100644
--- a/tests/auto/quick/qquickanimators/data/tst_y.qml
+++ b/tests/auto/qmltest/animators/tst_y.qml
@@ -49,7 +49,7 @@ Item {
TestCase {
id: testCase
- name: "y"
+ name: "animators-y"
when: !animation.running
function test_endresult() {
compare(box.yChangeCounter, 1);
@@ -70,7 +70,7 @@ Item {
target: box
from: 0;
to: 100
- duration: 1000
+ duration: 100
running: true
}
}
diff --git a/tests/auto/quick/qquickanimators/data/windowWithAnimator.qml b/tests/auto/quick/qquickanimators/data/windowWithAnimator.qml
new file mode 100644
index 0000000000..d49b91da83
--- /dev/null
+++ b/tests/auto/quick/qquickanimators/data/windowWithAnimator.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Window 2.0
+
+Window {
+ width: 200
+ height: 200
+
+ visible: true
+ property bool animationDone: rect.scale == 1;
+
+ Rectangle {
+ id: rect
+ anchors.centerIn: parent
+
+ width: 100
+ height: 100
+ color: "red"
+ scale: 0
+
+ ScaleAnimator on scale {
+ id: animation;
+ from: 0
+ to: 1
+ duration: 1000
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimators/qquickanimators.pro b/tests/auto/quick/qquickanimators/qquickanimators.pro
index 4fa0438e41..4ff2471fde 100644
--- a/tests/auto/quick/qquickanimators/qquickanimators.pro
+++ b/tests/auto/quick/qquickanimators/qquickanimators.pro
@@ -1,14 +1,6 @@
-QT += core-private gui-private qml-private
-TEMPLATE=app
+QT += core-private gui-private qml-private quick-private testlib
TARGET=tst_qquickanimators
-
-CONFIG += qmltestcase
+CONFIG += testcase
+macx: CONFIG -= app_bundle
SOURCES += tst_qquickanimators.cpp
-TESTDATA = data/*
-
-OTHER_FILES += \
- data/tst_scale.qml \
- data/Scale.qml \
- tst_on.qml \
- data/tst_nested.qml
diff --git a/tests/auto/quick/qquickanimators/tst_qquickanimators.cpp b/tests/auto/quick/qquickanimators/tst_qquickanimators.cpp
index f3f982091f..3311fa6bf2 100644
--- a/tests/auto/quick/qquickanimators/tst_qquickanimators.cpp
+++ b/tests/auto/quick/qquickanimators/tst_qquickanimators.cpp
@@ -39,6 +39,75 @@
**
****************************************************************************/
-#include <QtQuickTest/quicktest.h>
+#include <qtest.h>
+
+#include <QtQuick>
+#include <private/qquickanimator_p.h>
+
+#include <QtQml>
+
+class tst_Animators: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testMultiWinAnimator_data();
+ void testMultiWinAnimator();
+};
+
+void tst_Animators::testMultiWinAnimator_data()
+{
+ QTest::addColumn<int>("count");
+
+ QTest::newRow("1") << 1;
+ QTest::newRow("10") << 10;
+}
+
+void tst_Animators::testMultiWinAnimator()
+{
+ QFETCH(int, count);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, "data/windowWithAnimator.qml");
+
+ QList<QQuickWindow *> windows;
+ for (int i=0; i<count; ++i) {
+ QQuickWindow *win = qobject_cast<QQuickWindow *>(component.create());
+ windows << win;
+
+ // As the windows are all the same size, if they are positioned at the
+ // same place only the top-most one will strictly be "exposed" and rendering
+ // for all the others will be disabled. Move the windows a little bit
+ // to ensure they are exposed and actually rendering.
+ if (i > 0) {
+ QPoint pos = win->position();
+ if (pos == windows.first()->position())
+ pos += QPoint(10 * i, 10 * i);
+ win->setPosition(pos);
+ }
+ }
+
+ // let all animations run their course...
+ while (true) {
+ QTest::qWait(200);
+ bool allDone = true;
+ for (int i=0; i<count; ++i) {
+ QQuickWindow *win = windows.at(i);
+ allDone = win->isExposed() && win->property("animationDone").toBool();
+ }
+
+ if (allDone) {
+ for (int i=0; i<count; ++i) {
+ QQuickWindow *win = windows.at(i);
+ delete win;
+ }
+ break;
+ }
+ }
+ QVERIFY(true);
+}
+
+#include "tst_qquickanimators.moc"
+
+QTEST_MAIN(tst_Animators)
-QUICK_TEST_MAIN(qquickanimators)