summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicspositioners
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-02-20 08:04:29 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-02-20 08:04:29 (GMT)
commit30b45ba2b11342a9e7cc06b68237b68a68955213 (patch)
tree1018c188375b3217b31abe9b7a0883ee1184a447 /tests/auto/declarative/qmlgraphicspositioners
parentce27cf24539e0c7971937e55d8539496ad51ee52 (diff)
parent8f10ca802dee1ed110f301191c4a56a85575033c (diff)
downloadQt-30b45ba2b11342a9e7cc06b68237b68a68955213.zip
Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.gz
Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.bz2
Merge remote branch 'origin/master' into qt-master-from-4.6
Conflicts: configure.exe src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp
Diffstat (limited to 'tests/auto/declarative/qmlgraphicspositioners')
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml4
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml4
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml4
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp194
4 files changed, 98 insertions, 108 deletions
diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml
index 022019c..f6376a1 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml
+++ b/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml
@@ -7,12 +7,12 @@ Item {
columns: 3
add: Transition {
NumberAnimation {
- matchProperties: "x,y";
+ properties: "x,y";
}
}
move: Transition {
NumberAnimation {
- matchProperties: "x,y";
+ properties: "x,y";
}
}
Rectangle {
diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml
index eba165c..c113a36 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml
+++ b/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml
@@ -6,12 +6,12 @@ Item {
Row {
add: Transition {
NumberAnimation {
- matchProperties: "x";
+ properties: "x";
}
}
move: Transition {
NumberAnimation {
- matchProperties: "x";
+ properties: "x";
}
}
Rectangle {
diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml
index 8e3abbd..10f6cbb 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml
+++ b/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml
@@ -6,12 +6,12 @@ Item {
Column {
add: Transition {
NumberAnimation {
- matchProperties: "y";
+ properties: "y";
}
}
move: Transition {
NumberAnimation {
- matchProperties: "y";
+ properties: "y";
}
}
Rectangle {
diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
index d6b4f87..b51266a 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
+++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
@@ -43,6 +43,7 @@
#include <qmlview.h>
#include <private/qmlgraphicsrectangle_p.h>
#include <qmlexpression.h>
+#include "../../../shared/util.h"
class tst_QmlGraphicsPositioners : public QObject
{
@@ -75,15 +76,14 @@ void tst_QmlGraphicsPositioners::test_horizontal()
QmlView *canvas = createView(SRCDIR "/data/horizontal.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -99,15 +99,14 @@ void tst_QmlGraphicsPositioners::test_horizontal_spacing()
QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -123,30 +122,31 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated()
QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml");
canvas->execute();
- qApp->processEvents();
- //Note that they animate in
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QCOMPARE(one->x(), -100.0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QCOMPARE(two->x(), -100.0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
+
+ //Note that they animate in
+ QCOMPARE(one->x(), -100.0);
+ QCOMPARE(two->x(), -100.0);
QCOMPARE(three->x(), -100.0);
- QTest::qWait(300);//Let the animation complete
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(two->opacity(), 0.0);
- QCOMPARE(two->x(), -100.0);//Not 'in' yet
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(three->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(two->opacity(), 0.0);
+ QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(three->x(), 50.0);
+ QTRY_COMPARE(three->y(), 0.0);
//Add 'two'
two->setOpacity(1.0);
@@ -154,9 +154,9 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated()
QTest::qWait(0);//Let the animation start
QCOMPARE(two->x(), -100.0);
QCOMPARE(three->x(), 50.0);
- QTest::qWait(300);//Let the animation complete
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(three->x(), 100.0);
+
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(three->x(), 100.0);
}
void tst_QmlGraphicsPositioners::test_vertical()
@@ -164,15 +164,14 @@ void tst_QmlGraphicsPositioners::test_vertical()
QmlView *canvas = createView(SRCDIR "/data/vertical.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -188,15 +187,14 @@ void tst_QmlGraphicsPositioners::test_vertical_spacing()
QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -212,41 +210,40 @@ void tst_QmlGraphicsPositioners::test_vertical_animated()
QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml");
canvas->execute();
- qApp->processEvents();
- QTest::qWait(0);//Let the animation start
//Note that they animate in
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->y(), -100.0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->y(), -100.0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->y(), -100.0);
- QTest::qWait(300);//Let the animation complete
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(two->opacity(), 0.0);
- QCOMPARE(two->y(), -100.0);//Not 'in' yet
- QCOMPARE(two->x(), 0.0);
- QCOMPARE(three->y(), 50.0);
- QCOMPARE(three->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(two->opacity(), 0.0);
+ QTRY_COMPARE(two->y(), -100.0);//Not 'in' yet
+ QTRY_COMPARE(two->x(), 0.0);
+ QTRY_COMPARE(three->y(), 50.0);
+ QTRY_COMPARE(three->x(), 0.0);
//Add 'two'
two->setOpacity(1.0);
- QCOMPARE(two->opacity(), 1.0);
+ QTRY_COMPARE(two->opacity(), 1.0);
QTest::qWait(0);//Let the animation start
QCOMPARE(two->y(), -100.0);
QCOMPARE(three->y(), 50.0);
- QTest::qWait(300);//Let the animation complete
- QCOMPARE(two->y(), 50.0);
- QCOMPARE(three->y(), 100.0);
+
+ QTRY_COMPARE(two->y(), 50.0);
+ QTRY_COMPARE(three->y(), 100.0);
}
@@ -255,17 +252,16 @@ void tst_QmlGraphicsPositioners::test_grid()
QmlView *canvas = createView("data/grid.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -285,17 +281,16 @@ void tst_QmlGraphicsPositioners::test_grid_spacing()
QmlView *canvas = createView("data/grid-spacing.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -314,48 +309,47 @@ void tst_QmlGraphicsPositioners::test_grid_animated()
{
QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml");
canvas->execute();
- qApp->processEvents();
- QTest::qWait(0);//Let the animation start
//Note that all animate in
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->x(), -100.0);
QCOMPARE(one->y(), -100.0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->x(), -100.0);
QCOMPARE(two->y(), -100.0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->x(), -100.0);
QCOMPARE(three->y(), -100.0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
QCOMPARE(four->x(), -100.0);
QCOMPARE(four->y(), -100.0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
- QTest::qWait(300);//Let the animation complete
-
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(two->opacity(), 0.0);
- QCOMPARE(two->y(), -100.0);
- QCOMPARE(two->x(), -100.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(three->x(), 50.0);
- QCOMPARE(four->y(), 0.0);
- QCOMPARE(four->x(), 100.0);
- QCOMPARE(five->y(), 50.0);
- QCOMPARE(five->x(), 0.0);
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(two->opacity(), 0.0);
+ QTRY_COMPARE(two->y(), -100.0);
+ QTRY_COMPARE(two->x(), -100.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(three->x(), 50.0);
+ QTRY_COMPARE(four->y(), 0.0);
+ QTRY_COMPARE(four->x(), 100.0);
+ QTRY_COMPARE(five->y(), 50.0);
+ QTRY_COMPARE(five->x(), 0.0);
//Add 'two'
two->setOpacity(1.0);
@@ -371,17 +365,17 @@ void tst_QmlGraphicsPositioners::test_grid_animated()
QCOMPARE(four->y(), 0.0);
QCOMPARE(five->x(), 0.0);
QCOMPARE(five->y(), 50.0);
- QTest::qWait(300);//Let the animation complete
- QCOMPARE(two->x(), 50.0);
- QCOMPARE(two->y(), 0.0);
- QCOMPARE(one->x(), 0.0);
- QCOMPARE(one->y(), 0.0);
- QCOMPARE(three->x(), 100.0);
- QCOMPARE(three->y(), 0.0);
- QCOMPARE(four->x(), 0.0);
- QCOMPARE(four->y(), 50.0);
- QCOMPARE(five->x(), 50.0);
- QCOMPARE(five->y(), 50.0);
+ //Let the animation complete
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(three->x(), 100.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(four->x(), 0.0);
+ QTRY_COMPARE(four->y(), 50.0);
+ QTRY_COMPARE(five->x(), 50.0);
+ QTRY_COMPARE(five->y(), 50.0);
}
@@ -390,15 +384,14 @@ void tst_QmlGraphicsPositioners::test_repeater()
QmlView *canvas = createView("data/repeater.qml");
canvas->execute();
- qApp->processEvents();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -413,10 +406,7 @@ QmlView *tst_QmlGraphicsPositioners::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}