diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-03-29 06:51:54 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-03-29 06:51:54 (GMT) |
commit | bf2f5fbd01b49dad9a2bdfd20d1ccba03936bf88 (patch) | |
tree | 4849d88509b994c65fbb1737a778c09f5cce0cd3 /tests | |
parent | 49d56ab243a5f490495a79ce98276e2f33c03658 (diff) | |
parent | e993f05e5b927909978e355b0bdea4c1406acafb (diff) | |
download | Qt-bf2f5fbd01b49dad9a2bdfd20d1ccba03936bf88.zip Qt-bf2f5fbd01b49dad9a2bdfd20d1ccba03936bf88.tar.gz Qt-bf2f5fbd01b49dad9a2bdfd20d1ccba03936bf88.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
7 files changed, 103 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml new file mode 100644 index 0000000..bd13bac --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Item { + width: 90 + height: 480 + Flow { + anchors.fill: parent + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 0e1fee2..9026566 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -65,6 +65,8 @@ private slots: void test_grid_animated(); void test_propertychanges(); void test_repeater(); + void test_flow(); + void test_flow_resize(); private: QDeclarativeView *createView(const QString &filename); }; @@ -441,6 +443,64 @@ void tst_QDeclarativePositioners::test_repeater() QCOMPARE(three->y(), 0.0); } +void tst_QDeclarativePositioners::test_flow() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 50.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 70.0); + QCOMPARE(five->x(), 50.0); + QCOMPARE(five->y(), 70.0); +} + +void tst_QDeclarativePositioners::test_flow_resize() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); + + QDeclarativeItem *root = qobject_cast<QDeclarativeItem*>(canvas->rootObject()); + QVERIFY(root); + root->setWidth(125); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 70.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); +} + QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation/data/parentAnimation.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation/data/parentAnimation-visual.qml index 5718560..5718560 100644 --- a/tests/auto/declarative/qmlvisual/animation/parentAnimation/data/parentAnimation.qml +++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation/data/parentAnimation-visual.qml diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml index 8d0b375..8d0b375 100644 --- a/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation.qml +++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml diff --git a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/data/pauseAnimation.qml b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/data/pauseAnimation-visual.qml index 73c6542..73c6542 100644 --- a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/data/pauseAnimation.qml +++ b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/data/pauseAnimation-visual.qml diff --git a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml index 8830170..8830170 100644 --- a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation.qml +++ b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index f87fd29..8f1a406 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -97,12 +97,12 @@ void tst_qmlvisual::visual_data() QTest::addColumn<QString>("testdata"); QStringList files; - if (qgetenv("RUN_ALL") != "") + if (qgetenv("QMLVISUAL_ALL") != "") files << findQmlFiles(QDir(QT_TEST_SOURCE_DIR)); else { //these are tests we think are stable and useful enough to be run by the CI system - files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation.qml"; - files << QT_TEST_SOURCE_DIR "/animation/parentAnimation/parentAnimation.qml"; + files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation-visual.qml"; + files << QT_TEST_SOURCE_DIR "/animation/parentAnimation/parentAnimation-visual.qml"; files << QT_TEST_SOURCE_DIR "/animation/reanchor/reanchor.qml"; } @@ -124,7 +124,7 @@ void tst_qmlvisual::visual() QStringList arguments; arguments << "-script" << testdata << "-scriptopts" << "play,testimages,testerror,exitoncomplete,exitonfailure" - << file; + << file << "-graphicssystem" << "raster"; QProcess p; p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); |