diff options
Diffstat (limited to 'tests')
80 files changed, 1009 insertions, 763 deletions
diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 85d2a73..b316cb9 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_examples.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 3d717bc..dfcc9c0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -44,6 +44,13 @@ #include <QProcess> #include <QDebug> +#define CONCURRENT + +#ifdef CONCURRENT +#include <QFutureSynchronizer> +#include <QtConcurrentRun> +#endif + class tst_examples : public QObject { Q_OBJECT @@ -51,7 +58,9 @@ public: tst_examples(); private slots: +#ifndef CONCURRENT void examples_data(); +#endif void examples(); void namingConvention(); @@ -81,6 +90,12 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + +#ifdef QT_NO_WEBKIT + excludedDirs << "examples/declarative/webview"; + excludedDirs << "demos/declarative/webbrowser"; +#endif + #ifdef QT_NO_XMLPATTERNS excludedDirs << "examples/declarative/xmldata"; excludedDirs << "demos/declarative/twitter"; @@ -101,19 +116,19 @@ void tst_examples::namingConvention(const QDir &d) return; } - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); bool seenQml = !files.isEmpty(); bool seenLowercase = false; foreach (const QString &file, files) { - if (file.at(0).isLower()) + if (file.at(0).isLower()) seenLowercase = true; } if (!seenQml) { - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -144,7 +159,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) QStringList rv; - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); foreach (const QString &file, files) { if (file.at(0).isLower()) { @@ -152,7 +167,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) } } - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -163,32 +178,126 @@ QStringList tst_examples::findQmlFiles(const QDir &d) return rv; } + + /* -This test runs all the examples in the declarative UI source tree and ensures +This test runs all the examples in the declarative UI source tree and ensures that they start and exit cleanly. Examples are any .qml files under the examples/ or demos/ directory that start -with a lower case letter. +with a lower case letter. */ +#ifndef CONCURRENT void tst_examples::examples_data() { QTest::addColumn<QString>("file"); - QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); - QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); + QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; + QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; + qWarning() << examples << demos << snippets; + QStringList files; files << findQmlFiles(QDir(examples)); files << findQmlFiles(QDir(demos)); files << findQmlFiles(QDir(snippets)); + qWarning() << files; + foreach (const QString &file, files) QTest::newRow(file.toLatin1().constData()) << file; } +#endif + +#ifdef CONCURRENT +#define THREADS 5 + +struct Example { +public: + Example() : result(Unknown) {} + + enum Result { Pass, Unknown, Fail }; + Result result; + QString file; + QString qmlruntime; + + void run(); +}; +void Example::run() +{ + QFileInfo fi(file); + QFileInfo dir(fi.path()); + QString script = SRCDIR "/data/"+dir.baseName()+"/"+fi.baseName(); + QFileInfo testdata(script+".qml"); + QStringList arguments; + arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" + << file; +#ifdef Q_WS_QWS + arguments << "-qws"; +#endif + + QProcess p; + p.start(qmlruntime, arguments); + if (!p.waitForFinished()) { + result = Fail; + return; + } + + if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) + qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); + + if (p.exitStatus() != QProcess::NormalExit || + p.exitCode() != 0) { + result = Fail; + return; + } else { + result = Pass; + return; + } +} + +#endif void tst_examples::examples() { +#ifdef CONCURRENT + QThreadPool::globalInstance()->setMaxThreadCount(5); + + QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; + QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; + QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; + + QStringList files; + files << findQmlFiles(QDir(examples)); + files << findQmlFiles(QDir(demos)); + files << findQmlFiles(QDir(snippets)); + + QList<Example> tests; + + for (int ii = 0; ii < files.count(); ++ii) { + Example e; + e.file = files.at(ii); + e.qmlruntime = qmlruntime; + tests << e; + } + + QFutureSynchronizer<void> sync; + + for (int ii = 0; ii < tests.count(); ++ii) { + Example *e = &tests[ii]; + QFuture<void> r = QtConcurrent::run(e, &Example::run); + sync.addFuture(r); + } + + sync.waitForFinished(); + + for (int ii = 0; ii < tests.count(); ++ii) + QVERIFY(tests.at(ii).result == Example::Pass); + +#else + QFETCH(QString, file); QFileInfo fi(file); @@ -197,7 +306,7 @@ void tst_examples::examples() QFileInfo testdata(script+".qml"); QStringList arguments; arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) - << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; #ifdef Q_WS_QWS arguments << "-qws"; @@ -210,6 +319,7 @@ void tst_examples::examples() qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); QCOMPARE(p.exitStatus(), QProcess::NormalExit); QCOMPARE(p.exitCode(), 0); +#endif } QTEST_MAIN(tst_examples) diff --git a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro index 712c34c..b77b430 100644 --- a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro +++ b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro @@ -6,3 +6,5 @@ SOURCES += tst_graphicswidgets.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index 48f147a..8830511 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index ca2f68f..a2403f2 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir b/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir new file mode 100644 index 0000000..ef7c1f4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir @@ -0,0 +1 @@ +# No local types diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 2904986..74f9be0 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -5,3 +5,6 @@ SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index 8eac75f..ce38eeb 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index e982f21..e9fb286 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml @@ -9,7 +9,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" x: basex - Behavior on x { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 800; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index b22441a..795b309 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml @@ -11,6 +11,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - Behavior on x { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 800; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index a1dac32..c2781b8 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 4c9c9ca..3bff2f5 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -45,6 +45,7 @@ #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativeanimation_p.h> +#include "../../../shared/util.h" class tst_qdeclarativebehaviors : public QObject { @@ -76,13 +77,13 @@ void tst_qdeclarativebehaviors::simpleBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QVERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); + QTRY_VERIFY(rect); + QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -92,12 +93,12 @@ void tst_qdeclarativebehaviors::scriptTriggered() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setColor(QColor("red")); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -107,15 +108,14 @@ void tst_qdeclarativebehaviors::cppTriggered() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); - QVERIFY(innerRect); + QTRY_VERIFY(innerRect); innerRect->setProperty("x", 200); - QTest::qWait(200); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(innerRect->x() > 0); + QTRY_VERIFY(innerRect->x() < 200); //i.e. the behavior has been triggered delete rect; } @@ -125,7 +125,7 @@ void tst_qdeclarativebehaviors::loop() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); //don't crash rect->setState("moved"); @@ -138,12 +138,12 @@ void tst_qdeclarativebehaviors::colorBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("red"); - QTest::qWait(200); - QColor color = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color(); - QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("red")); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("green")); + //i.e. the behavior has been triggered delete rect; } @@ -153,16 +153,11 @@ void tst_qdeclarativebehaviors::parentBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("reparented"); - QTest::qWait(200); - QDeclarativeItem *newParent = rect->findChild<QDeclarativeItem*>("NewParent"); - QDeclarativeItem *parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); - QVERIFY(parent != newParent); - QTest::qWait(600); - parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); - QVERIFY(parent == newParent); + QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() != rect->findChild<QDeclarativeItem*>("NewParent")); + QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() == rect->findChild<QDeclarativeItem*>("NewParent")); delete rect; } @@ -172,33 +167,28 @@ void tst_qdeclarativebehaviors::replaceBinding() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); - QVERIFY(innerRect); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)200); + QTRY_VERIFY(innerRect); + QTRY_VERIFY(innerRect->x() > 0); + QTRY_VERIFY(innerRect->x() < 200); + //i.e. the behavior has been triggered + QTRY_COMPARE(innerRect->x(), (qreal)200); rect->setProperty("basex", 10); - QCOMPARE(innerRect->x(), (qreal)200); + QTRY_COMPARE(innerRect->x(), (qreal)200); rect->setProperty("movedx", 210); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)210); + QTRY_COMPARE(innerRect->x(), (qreal)210); rect->setState(""); - QTest::qWait(200); - x = innerRect->x(); - QVERIFY(x > 10 && x < 210); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)10); + QTRY_VERIFY(innerRect->x() > 10); + QTRY_VERIFY(innerRect->x() < 210); //i.e. the behavior has been triggered + QTRY_COMPARE(innerRect->x(), (qreal)10); rect->setProperty("movedx", 200); - QCOMPARE(innerRect->x(), (qreal)10); + QTRY_COMPARE(innerRect->x(), (qreal)10); rect->setProperty("basex", 20); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)20); + QTRY_COMPARE(innerRect->x(), (qreal)20); delete rect; } @@ -209,12 +199,13 @@ void tst_qdeclarativebehaviors::group() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + //QTest::qWait(200); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -223,12 +214,12 @@ void tst_qdeclarativebehaviors::group() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -239,46 +230,42 @@ void tst_qdeclarativebehaviors::emptyBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + QTRY_COMPARE(x, qreal(200)); //should change immediately delete rect; } void tst_qdeclarativebehaviors::explicitSelection() { - { - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QTRY_VERIFY(rect); - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + rect->setState("moved"); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered - delete rect; - } + delete rect; } void tst_qdeclarativebehaviors::nonSelectingBehavior() { - { - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QTRY_VERIFY(rect); - rect->setState("moved"); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + rect->setState("moved"); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QTRY_COMPARE(x, qreal(200)); //should change immediately - delete rect; - } + delete rect; } void tst_qdeclarativebehaviors::reassignedAnimation() @@ -287,8 +274,8 @@ void tst_qdeclarativebehaviors::reassignedAnimation() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>( + QTRY_VERIFY(rect); + QTRY_COMPARE(qobject_cast<QDeclarativeNumberAnimation*>( qobject_cast<QDeclarativeBehavior*>( rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation())->duration(), 200); @@ -300,12 +287,12 @@ void tst_qdeclarativebehaviors::disabled() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); + QTRY_VERIFY(rect); + QTRY_COMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); rect->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + QTRY_COMPARE(x, qreal(200)); //should change immediately delete rect; } @@ -318,11 +305,11 @@ void tst_qdeclarativebehaviors::dontStart() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + QTRY_VERIFY(myAnim && myAnim->qtAnimation()); + QTRY_VERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); delete rect; } @@ -332,12 +319,12 @@ void tst_qdeclarativebehaviors::startup() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); - QVERIFY(innerRect); + QTRY_VERIFY(innerRect); - QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately + QTRY_COMPARE(innerRect->x(), qreal(100)); //should be set immediately delete rect; } diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index 7879976..04dd6f5 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativebinding.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index 0574ddb..e754923 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 8aeba6d..bb965a9 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -148,7 +148,7 @@ void tst_qdeclarativeborderimage::imageSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); @@ -267,14 +267,14 @@ void tst_qdeclarativeborderimage::sciSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); - + QCOMPARE(obj->source(), remote ? source : QUrl(source)); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); - + if (valid) { TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->border()->left(), 10); @@ -342,8 +342,8 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data() { QTest::addColumn<QString>("source"); - QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; - QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; + QTest::newRow("png file") << "http://localhost/none.png"; + QTest::newRow("sci file") << "http://localhost/none.sci"; } QTEST_MAIN(tst_qdeclarativeborderimage) diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index c7affb7..e58c798 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -6,3 +6,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index a6adfa4..959354d 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeconnection.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index adace70..5db9a9e 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro index ff1d0d4..1214fcf 100644 --- a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro +++ b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebug.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro index e375889..a62e148 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro +++ b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebugservice.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 35df26e..466c563 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index 0e21cb2..eabed26 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -8,3 +8,6 @@ HEADERS += testtypes.h # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index 5b6530d..e0ea2e5 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeengine.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro index 6591406..501f32c 100644 --- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeerror.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index 4b71381..07637c9 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeflickable.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index e29d324..9830b55 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeflipable.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index 4d7a9b3..687c80c 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -4,3 +4,4 @@ SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 3ba50be..9a8a3ff 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index af206d7..b069260 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativegridview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7add9c6..07fc3aa 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -50,6 +50,7 @@ #include <QtDeclarative/private/qdeclarativegridview_p.h> #include <QtDeclarative/private/qdeclarativetext_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> +#include "../../../shared/util.h" class tst_QDeclarativeGridView : public QObject { @@ -169,21 +170,21 @@ void tst_QDeclarativeGridView::items() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(gridview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(gridview->count(), model.count()); + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // set an empty model and confirm that items are destroyed @@ -191,7 +192,7 @@ void tst_QDeclarativeGridView::items() ctxt->setContextProperty("testModel", &model2); int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); + QTRY_VERIFY(itemCount == 0); delete canvas; } @@ -217,18 +218,18 @@ void tst_QDeclarativeGridView::changed() qApp->processEvents(); QDeclarativeFlickable *gridview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.modifyItem(1, "Will", "9876"); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); delete canvas; } @@ -250,71 +251,62 @@ void tst_QDeclarativeGridView::inserted() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.insertItem(1, "Will", "9876"); - // let transitions settle. - QTest::qWait(100); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Checks that onAdd is called int added = canvas->rootObject()->property("added").toInt(); - QCOMPARE(added, 1); + QTRY_COMPARE(added, 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->x(), (i%3)*80.0); - QCOMPARE(item->y(), (i/3)*60.0); + QTRY_COMPARE(item->x(), (i%3)*80.0); + QTRY_COMPARE(item->y(), (i/3)*60.0); } model.insertItem(0, "Foo", "1111"); // zero index, and current item - // let transitions settle. - QTest::qWait(100); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); - QCOMPARE(gridview->currentIndex(), 1); + QTRY_COMPARE(gridview->currentIndex(), 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(100); gridview->setContentY(120); - QTest::qWait(100); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(100); - QVERIFY(gridview->contentY() == 120); + QTRY_VERIFY(gridview->contentY() == 120); delete canvas; } @@ -335,107 +327,91 @@ void tst_QDeclarativeGridView::removed() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.removeItem(1); - // let transitions settle. - QTest::qWait(100); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Checks that onRemove is called QString removed = canvas->rootObject()->property("removed").toString(); - QCOMPARE(removed, QString("Item1")); + QTRY_COMPARE(removed, QString("Item1")); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove first item (which is the current item); model.removeItem(0); - // let transitions settle. - QTest::qWait(100); - name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove items not visible model.removeItem(25); - // let transitions settle. - QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove items before visible gridview->setContentY(120); - QTest::qWait(100); gridview->setCurrentIndex(10); - // let transitions settle. - QTest::qWait(100); - // Setting currentIndex above shouldn't cause view to scroll - QCOMPARE(gridview->contentY(), 120.0); + QTRY_COMPARE(gridview->contentY(), 120.0); model.removeItem(1); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly for (int i = 6; i < 18; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove currentIndex QDeclarativeItem *oldCurrent = gridview->currentItem(); model.removeItem(9); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 9); - QVERIFY(gridview->currentItem() != oldCurrent); + QTRY_COMPARE(gridview->currentIndex(), 9); + QTRY_VERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); // let transitions settle. @@ -446,39 +422,34 @@ void tst_QDeclarativeGridView::removed() for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // remove item outside current view. gridview->setCurrentIndex(32); - QTest::qWait(100); gridview->setContentY(240); model.removeItem(30); - QVERIFY(gridview->currentIndex() == 31); + QTRY_VERIFY(gridview->currentIndex() == 31); // remove current item beyond visible items. gridview->setCurrentIndex(20); - QTest::qWait(100); gridview->setContentY(0); model.removeItem(20); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 20); - QVERIFY(gridview->currentItem() != 0); + QTRY_COMPARE(gridview->currentIndex(), 20); + QTRY_VERIFY(gridview->currentItem() != 0); // remove item before current, but visible gridview->setCurrentIndex(8); - QTest::qWait(100); gridview->setContentY(240); oldCurrent = gridview->currentItem(); model.removeItem(6); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 7); - QVERIFY(gridview->currentItem() == oldCurrent); + QTRY_COMPARE(gridview->currentIndex(), 7); + QTRY_VERIFY(gridview->currentItem() == oldCurrent); delete canvas; } @@ -499,38 +470,35 @@ void tst_QDeclarativeGridView::moved() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.moveItem(1, 8); - // let transitions settle. - QTest::qWait(100); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); name = findItem<QDeclarativeText>(viewport, "textName", 8); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(8)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(8)); number = findItem<QDeclarativeText>(viewport, "textNumber", 8); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(8)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(8)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } gridview->setContentY(120); @@ -538,50 +506,44 @@ void tst_QDeclarativeGridView::moved() // move outside visible area model.moveItem(1, 25); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly and indexes correct itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count()-1; for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // move from outside visible into visible model.moveItem(28, 8); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly and indexes correct for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // ensure content position is stable gridview->setContentY(0); model.moveItem(10, 0); - QVERIFY(gridview->contentY() == 0); + QTRY_VERIFY(gridview->contentY() == 0); delete canvas; } @@ -604,65 +566,59 @@ void tst_QDeclarativeGridView::currentIndex() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(300); + QTRY_VERIFY(viewport != 0); // current item should be third item - QCOMPARE(gridview->currentIndex(), 5); - QCOMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 5)); - QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); + QTRY_COMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 5)); + QTRY_COMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 6); + QTRY_COMPARE(gridview->currentIndex(), 6); gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), 9); + QTRY_COMPARE(gridview->currentIndex(), 9); gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 6); + QTRY_COMPARE(gridview->currentIndex(), 6); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentIndex(), 5); // no wrap gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->setCurrentIndex(model.count()-1); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); // with wrap gridview->setWrapEnabled(true); gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); - QTest::qWait(500); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 279.0); + QTRY_COMPARE(gridview->contentY(), 279.0); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 0.0); + QTRY_COMPARE(gridview->contentY(), 0.0); // Test keys canvas->show(); @@ -671,47 +627,46 @@ void tst_QDeclarativeGridView::currentIndex() // to be safe and avoid failing setFocus with window managers qt_x11_wait_for_window_manager(canvas); #endif - QVERIFY(canvas->hasFocus()); - QVERIFY(canvas->scene()->hasFocus()); + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); qApp->processEvents(); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 3); + QTRY_COMPARE(gridview->currentIndex(), 3); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->setFlow(QDeclarativeGridView::TopToBottom); QTest::keyClick(canvas, Qt::Key_Right); - QCOMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentIndex(), 5); QTest::keyClick(canvas, Qt::Key_Left); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 1); + QTRY_COMPARE(gridview->currentIndex(), 1); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); // turn off auto highlight gridview->setHighlightFollowsCurrentItem(false); - QVERIFY(gridview->highlightFollowsCurrentItem() == false); - QVERIFY(gridview->highlightItem()); + QTRY_VERIFY(gridview->highlightFollowsCurrentItem() == false); + QTRY_VERIFY(gridview->highlightItem()); qreal hlPosX = gridview->highlightItem()->x(); qreal hlPosY = gridview->highlightItem()->y(); gridview->setCurrentIndex(5); - QTest::qWait(500); - QCOMPARE(gridview->highlightItem()->x(), hlPosX); - QCOMPARE(gridview->highlightItem()->y(), hlPosY); + QTRY_COMPARE(gridview->highlightItem()->x(), hlPosX); + QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY); // insert item before currentIndex gridview->setCurrentIndex(28); model.insertItem(0, "Foo", "1111"); - QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); delete canvas; } @@ -732,44 +687,43 @@ void tst_QDeclarativeGridView::changeFlow() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly and indexes correct int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } ctxt->setContextProperty("testTopToBottom", QVariant(true)); - QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i/5)*80)); - QCOMPARE(item->y(), qreal((i%5)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i/5)*80)); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } delete canvas; @@ -781,20 +735,20 @@ void tst_QDeclarativeGridView::defaultValues() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->model() == QVariant()); - QVERIFY(obj->delegate() == 0); - QCOMPARE(obj->currentIndex(), -1); - QVERIFY(obj->currentItem() == 0); - QCOMPARE(obj->count(), 0); - QVERIFY(obj->highlight() == 0); - QVERIFY(obj->highlightItem() == 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), true); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), false); - QCOMPARE(obj->cacheBuffer(), 0); - QCOMPARE(obj->cellWidth(), 100); //### Should 100 be the default? - QCOMPARE(obj->cellHeight(), 100); + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->model() == QVariant()); + QTRY_VERIFY(obj->delegate() == 0); + QTRY_COMPARE(obj->currentIndex(), -1); + QTRY_VERIFY(obj->currentItem() == 0); + QTRY_COMPARE(obj->count(), 0); + QTRY_VERIFY(obj->highlight() == 0); + QTRY_VERIFY(obj->highlightItem() == 0); + QTRY_COMPARE(obj->highlightFollowsCurrentItem(), true); + QTRY_VERIFY(obj->flow() == 0); + QTRY_COMPARE(obj->isWrapEnabled(), false); + QTRY_COMPARE(obj->cacheBuffer(), 0); + QTRY_COMPARE(obj->cellWidth(), 100); //### Should 100 be the default? + QTRY_COMPARE(obj->cellHeight(), 100); delete obj; } @@ -804,59 +758,59 @@ void tst_QDeclarativeGridView::properties() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->model() != QVariant()); - QVERIFY(obj->delegate() != 0); - QCOMPARE(obj->currentIndex(), 0); - QVERIFY(obj->currentItem() != 0); - QCOMPARE(obj->count(), 4); - QVERIFY(obj->highlight() != 0); - QVERIFY(obj->highlightItem() != 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), false); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), true); - QCOMPARE(obj->cacheBuffer(), 200); - QCOMPARE(obj->cellWidth(), 100); - QCOMPARE(obj->cellHeight(), 100); + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->model() != QVariant()); + QTRY_VERIFY(obj->delegate() != 0); + QTRY_COMPARE(obj->currentIndex(), 0); + QTRY_VERIFY(obj->currentItem() != 0); + QTRY_COMPARE(obj->count(), 4); + QTRY_VERIFY(obj->highlight() != 0); + QTRY_VERIFY(obj->highlightItem() != 0); + QTRY_COMPARE(obj->highlightFollowsCurrentItem(), false); + QTRY_VERIFY(obj->flow() == 0); + QTRY_COMPARE(obj->isWrapEnabled(), true); + QTRY_COMPARE(obj->cacheBuffer(), 200); + QTRY_COMPARE(obj->cellWidth(), 100); + QTRY_COMPARE(obj->cellHeight(), 100); delete obj; } void tst_QDeclarativeGridView::propertyChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged())); QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged())); QSignalSpy flowSpy(gridView, SIGNAL(flowChanged())); - QCOMPARE(gridView->isWrapEnabled(), true); - QCOMPARE(gridView->cacheBuffer(), 10); - QCOMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); + QTRY_COMPARE(gridView->isWrapEnabled(), true); + QTRY_COMPARE(gridView->cacheBuffer(), 10); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QDeclarativeGridView::TopToBottom); - QCOMPARE(gridView->isWrapEnabled(), false); - QCOMPARE(gridView->cacheBuffer(), 3); - QCOMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(gridView->isWrapEnabled(), false); + QTRY_COMPARE(gridView->cacheBuffer(), 3); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),1); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QDeclarativeGridView::TopToBottom); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),1); delete canvas; } @@ -864,11 +818,11 @@ void tst_QDeclarativeGridView::propertyChanges() void tst_QDeclarativeGridView::componentChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QDeclarativeComponent component(canvas->engine()); component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); @@ -882,43 +836,43 @@ void tst_QDeclarativeGridView::componentChanges() gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); - QCOMPARE(gridView->highlight(), &component); - QCOMPARE(gridView->delegate(), &delegateComponent); + QTRY_COMPARE(gridView->highlight(), &component); + QTRY_COMPARE(gridView->delegate(), &delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); delete canvas; } void tst_QDeclarativeGridView::modelChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel"); - QVERIFY(alternateModel); + QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(gridView, SIGNAL(modelChanged())); gridView->setModel(modelVariant); - QCOMPARE(gridView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(gridView->model(), modelVariant); + QTRY_COMPARE(modelSpy.count(),1); gridView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.count(),1); gridView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.count(),2); delete canvas; } @@ -938,117 +892,117 @@ void tst_QDeclarativeGridView::positionViewAtIndex() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on a currently visible item gridview->positionViewAtIndex(4, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 60.); + QTRY_COMPARE(gridview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on an item beyond the visible items gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 420.); + QTRY_COMPARE(gridview->contentY(), 420.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 520.); + QTRY_COMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position at the beginning again gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 0.); + QTRY_COMPARE(gridview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position at End gridview->positionViewAtIndex(30, QDeclarativeGridView::End); - QCOMPARE(gridview->contentY(), 340.); + QTRY_COMPARE(gridview->contentY(), 340.); // Position in Center gridview->positionViewAtIndex(15, QDeclarativeGridView::Center); - QCOMPARE(gridview->contentY(), 170.); + QTRY_COMPARE(gridview->contentY(), 170.); // Ensure at least partially visible gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 170.); + QTRY_COMPARE(gridview->contentY(), 170.); gridview->setContentY(302); gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 302.); + QTRY_COMPARE(gridview->contentY(), 302.); gridview->setContentY(360); gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 300.); + QTRY_COMPARE(gridview->contentY(), 300.); gridview->setContentY(60); gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 60.); + QTRY_COMPARE(gridview->contentY(), 60.); gridview->setContentY(20); gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); // Ensure completely visible gridview->setContentY(120); gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 120.); + QTRY_COMPARE(gridview->contentY(), 120.); gridview->setContentY(302); gridview->positionViewAtIndex(15, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 300.); + QTRY_COMPARE(gridview->contentY(), 300.); gridview->setContentY(60); gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); delete canvas; } @@ -1068,29 +1022,29 @@ void tst_QDeclarativeGridView::resetModel() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(gridview->count(), model.rowCount()); + QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } strings.clear(); strings << "four" << "five" << "six" << "seven"; model.setStringList(strings); - QCOMPARE(gridview->count(), model.rowCount()); + QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } } @@ -1109,34 +1063,33 @@ void tst_QDeclarativeGridView::enforceRange() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); - QCOMPARE(gridview->preferredHighlightBegin(), 100.0); - QCOMPARE(gridview->preferredHighlightEnd(), 100.0); - QCOMPARE(gridview->highlightRangeMode(), QDeclarativeGridView::StrictlyEnforceRange); + QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0); + QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0); + QTRY_COMPARE(gridview->highlightRangeMode(), QDeclarativeGridView::StrictlyEnforceRange); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // view should be positioned at the top of the range. QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); - QVERIFY(item); - QCOMPARE(gridview->contentY(), -100.0); + QTRY_VERIFY(item); + QTRY_COMPARE(gridview->contentY(), -100.0); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when viewport moves gridview->setContentY(0); - QCOMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentIndex(), 2); gridview->setCurrentIndex(5); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); delete canvas; } @@ -1149,9 +1102,9 @@ void tst_QDeclarativeGridView::QTBUG_8456() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); } QDeclarativeView *tst_QDeclarativeGridView::createView() diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index 7634c12..ff365ee 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index a4d3eb2..22be991 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -10,3 +10,6 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index 015c094..bb54d6c 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index b8f7d27..0daa9e5 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index 0eb2141..e834a4e 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index d7c1def..5771469 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -12,3 +12,5 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml new file mode 100644 index 0000000..672cb8f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml @@ -0,0 +1 @@ +NamedLocal { } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir index da10ba9..60150f8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir @@ -1,4 +1,5 @@ Test Test.qml TestSubDir TestSubDir.qml TestLocal TestLocal.qml +NamedLocal LocalInternal.qml internal LocalInternal LocalInternal.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index bfb56ba..c033c48 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -52,6 +52,7 @@ #include "testtypes.h" #include "../../../shared/util.h" +#include "testhttpserver.h" /* This test case covers QML language issues. This covers everything that does not @@ -116,6 +117,8 @@ private slots: void defaultPropertyListOrder(); void declaredPropertyValues(); + void basicRemote_data(); + void basicRemote(); void importsBuiltin_data(); void importsBuiltin(); void importsLocal_data(); @@ -1298,6 +1301,40 @@ void tst_qdeclarativelanguage::importsLocal() testType(qml,type,error); } +void tst_qdeclarativelanguage::basicRemote_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage/"; + + QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << ""; + QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << ""; +} + +void tst_qdeclarativelanguage::basicRemote() +{ + QFETCH(QUrl, url); + QFETCH(QString, type); + QFETCH(QString, error); + + TestHTTPServer server(14445); + server.serveDirectory(SRCDIR); + + QDeclarativeComponent component(&engine, url); + + QTRY_VERIFY(!component.isLoading()); + + if (error.isEmpty()) { + if (component.isError()) + qDebug() << component.errors(); + QVERIFY(!component.isError()); + } else { + QVERIFY(component.isError()); + } +} + void tst_qdeclarativelanguage::importsRemote_data() { QTest::addColumn<QString>("qml"); @@ -1320,8 +1357,6 @@ void tst_qdeclarativelanguage::importsRemote_data() << "UndeclaredLocal is not a type"; } -#include "testhttpserver.h" - void tst_qdeclarativelanguage::importsRemote() { QFETCH(QString, qml); diff --git a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro index 7276162..a2065f4 100644 --- a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro +++ b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 8813242..9f1e146 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativelistmodel.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro index 0c9b2d9..f3e6f52 100644 --- a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro +++ b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistreference.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index 3a076f8..5d962c0 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativelistview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 8d94804..e76da42 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -50,6 +50,7 @@ #include <QtDeclarative/private/qdeclarativevisualitemmodel_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> #include <QtDeclarative/private/qlistmodelinterface_p.h> +#include "../../../shared/util.h" class tst_QDeclarativeListView : public QObject { @@ -325,62 +326,59 @@ void tst_QDeclarativeListView::items() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); + QTRY_VERIFY(testObject->error() == false); - QVERIFY(listview->highlightItem() != 0); - QCOMPARE(listview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_COMPARE(listview->count(), model.count()); + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item // current item should be first item - QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); for (int i = 0; i < model.count(); ++i) { QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // switch to other delegate testObject->setAnimate(true); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); // set invalid highlight testObject->setInvalidHighlight(true); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() == 0); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); + QTRY_VERIFY(listview->highlightItem() == 0); // back to normal highlight testObject->setInvalidHighlight(false); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); + QTRY_VERIFY(listview->highlightItem() != 0); // set an empty model and confirm that items are destroyed T model2; ctxt->setContextProperty("testModel", &model2); - // Allow deleteLaters to process - QTest::qWait(500); - int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); + QTRY_VERIFY(itemCount == 0); - QCOMPARE(listview->highlightResizeSpeed(), 1000.0); - QCOMPARE(listview->highlightMoveSpeed(), 1000.0); + QTRY_COMPARE(listview->highlightResizeSpeed(), 1000.0); + QTRY_COMPARE(listview->highlightMoveSpeed(), 1000.0); delete canvas; } @@ -406,18 +404,18 @@ void tst_QDeclarativeListView::changed() qApp->processEvents(); QDeclarativeFlickable *listview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.modifyItem(1, "Will", "9876"); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); delete canvas; } @@ -442,75 +440,66 @@ void tst_QDeclarativeListView::inserted() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.insertItem(1, "Will", "9876"); - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); + QTRY_COMPARE(item->y(), i*20.0); } model.insertItem(0, "Foo", "1111"); // zero index, and current item - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); + QTRY_COMPARE(item->y(), i*20.0); } for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(300); listview->setContentY(80); - QTest::qWait(300); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(300); - QVERIFY(listview->contentY() == 80); + QTRY_VERIFY(listview->contentY() == 80); // Confirm items positioned correctly for (int i = 5; i < 5+15; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 - 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 - 20.0); } -// QCOMPARE(listview->viewportHeight(), model.count() * 20.0); +// QTRY_COMPARE(listview->viewportHeight(), model.count() * 20.0); delete canvas; } @@ -535,66 +524,60 @@ void tst_QDeclarativeListView::removed(bool animated) qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.removeItem(1); - // let transitions settle. - QTest::qWait(300); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } // Remove first item (which is the current item); model.removeItem(0); // post: top item starts at 20 - // let transitions settle. QTest::qWait(300); name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0 + 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),i*20.0 + 20.0); } // Remove items not visible model.removeItem(18); - // let transitions settle. - QTest::qWait(300); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0+20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),i*20.0+20.0); } // Remove items before visible @@ -602,25 +585,22 @@ void tst_QDeclarativeListView::removed(bool animated) listview->setCurrentIndex(10); model.removeItem(1); // post: top item will be at 40 - // let transitions settle. - QTest::qWait(300); // Confirm items positioned correctly for (int i = 2; i < 18; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),40+i*20.0); } // Remove current index - QVERIFY(listview->currentIndex() == 9); + QTRY_VERIFY(listview->currentIndex() == 9); QDeclarativeItem *oldCurrent = listview->currentItem(); model.removeItem(9); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 9); - QVERIFY(listview->currentItem() != oldCurrent); + QTRY_COMPARE(listview->currentIndex(), 9); + QTRY_VERIFY(listview->currentItem() != oldCurrent); listview->setContentY(40); // That's the top now // let transitions settle. @@ -631,29 +611,25 @@ void tst_QDeclarativeListView::removed(bool animated) for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),40+i*20.0); } // remove current item beyond visible items. listview->setCurrentIndex(20); - QTest::qWait(300); listview->setContentY(40); model.removeItem(20); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 20); - QVERIFY(listview->currentItem() != 0); + QTRY_COMPARE(listview->currentIndex(), 20); + QTRY_VERIFY(listview->currentItem() != 0); // remove item before current, but visible listview->setCurrentIndex(8); - QTest::qWait(300); oldCurrent = listview->currentItem(); model.removeItem(6); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 7); - QVERIFY(listview->currentItem() == oldCurrent); + QTRY_COMPARE(listview->currentIndex(), 7); + QTRY_VERIFY(listview->currentItem() == oldCurrent); delete canvas; } @@ -677,19 +653,16 @@ void tst_QDeclarativeListView::clear() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.clear(); - // let transitions settle. - QTest::qWait(500); - - QVERIFY(listview->count() == 0); - QVERIFY(listview->currentItem() == 0); - QVERIFY(listview->contentY() == 0); + QTRY_VERIFY(listview->count() == 0); + QTRY_VERIFY(listview->currentItem() == 0); + QTRY_VERIFY(listview->contentY() == 0); delete canvas; } @@ -714,37 +687,34 @@ void tst_QDeclarativeListView::moved() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.moveItem(1, 4); - // let transitions settle. - QTest::qWait(500); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); name = findItem<QDeclarativeText>(viewport, "textName", 4); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(4)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(4)); number = findItem<QDeclarativeText>(viewport, "textNumber", 4); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(4)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(4)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } listview->setContentY(80); @@ -752,41 +722,35 @@ void tst_QDeclarativeListView::moved() // move outside visible area model.moveItem(1, 18); - // let transitions settle. - QTest::qWait(500); - // Confirm items positioned correctly and indexes correct for (int i = 3; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 + 20); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // move from outside visible into visible model.moveItem(20, 4); - // let transitions settle. - QTest::qWait(500); - // Confirm items positioned correctly and indexes correct for (int i = 3; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 + 20); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } delete canvas; @@ -807,32 +771,31 @@ void tst_QDeclarativeListView::enforceRange() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); - QCOMPARE(listview->preferredHighlightBegin(), 100.0); - QCOMPARE(listview->preferredHighlightEnd(), 100.0); - QCOMPARE(listview->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QTRY_COMPARE(listview->preferredHighlightBegin(), 100.0); + QTRY_COMPARE(listview->preferredHighlightEnd(), 100.0); + QTRY_COMPARE(listview->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // view should be positioned at the top of the range. QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); - QVERIFY(item); - QCOMPARE(listview->contentY(), -100.0); + QTRY_VERIFY(item); + QTRY_COMPARE(listview->contentY(), -100.0); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when viewport moves listview->setContentY(20); - QTest::qWait(500); - QCOMPARE(listview->currentIndex(), 6); + QTRY_COMPARE(listview->currentIndex(), 6); delete canvas; } @@ -855,30 +818,30 @@ void tst_QDeclarativeListView::spacing() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } listview->setSpacing(10); - QVERIFY(listview->spacing() == 10); + QTRY_VERIFY(listview->spacing() == 10); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*30); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*30); } listview->setSpacing(0); @@ -888,8 +851,8 @@ void tst_QDeclarativeListView::spacing() for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0); } delete canvas; @@ -910,63 +873,60 @@ void tst_QDeclarativeListView::sections() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QVERIFY(item); - QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); } // Remove section boundary model.removeItem(5); - QTest::qWait(100); // New section header created QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); model.insertItem(3, "New Item", "0"); - QTest::qWait(100); // Section header moved item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); // insert item which will become a section header model.insertItem(6, "Replace header", "1"); - QTest::qWait(100); item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); item = findItem<QDeclarativeItem>(viewport, "wrapper", 7); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); - QCOMPARE(listview->currentSection(), QString("0")); + QTRY_COMPARE(listview->currentSection(), QString("0")); listview->setContentY(140); - QCOMPARE(listview->currentSection(), QString("1")); + QTRY_COMPARE(listview->currentSection(), QString("1")); listview->setContentY(20); - QCOMPARE(listview->currentSection(), QString("0")); + QTRY_COMPARE(listview->currentSection(), QString("0")); item = findItem<QDeclarativeItem>(viewport, "wrapper", 1); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); delete canvas; } @@ -990,45 +950,41 @@ void tst_QDeclarativeListView::currentIndex() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(500); + QTRY_VERIFY(viewport != 0); // current item should be third item - QCOMPARE(listview->currentIndex(), 3); - QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 3)); - QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + QTRY_COMPARE(listview->currentIndex(), 3); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 3)); + QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); // no wrap listview->setCurrentIndex(0); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); // with wrap ctxt->setContextProperty("testWrap", QVariant(true)); - QVERIFY(listview->isWrapEnabled()); + QTRY_VERIFY(listview->isWrapEnabled()); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), model.count()-1); + QTRY_COMPARE(listview->currentIndex(), model.count()-1); - QTest::qWait(1000); - QCOMPARE(listview->contentY(), 279.0); + QTRY_COMPARE(listview->contentY(), 279.0); listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); - QTest::qWait(1000); - QCOMPARE(listview->contentY(), 0.0); + QTRY_COMPARE(listview->contentY(), 0.0); // Test keys canvas->show(); @@ -1037,32 +993,30 @@ void tst_QDeclarativeListView::currentIndex() // to be safe and avoid failing setFocus with window managers qt_x11_wait_for_window_manager(canvas); #endif - QVERIFY(canvas->hasFocus()); - QVERIFY(canvas->scene()->hasFocus()); + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); qApp->processEvents(); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); // turn off auto highlight listview->setHighlightFollowsCurrentItem(false); - QVERIFY(listview->highlightFollowsCurrentItem() == false); + QTRY_VERIFY(listview->highlightFollowsCurrentItem() == false); - QTest::qWait(500); - QVERIFY(listview->highlightItem()); + QTRY_VERIFY(listview->highlightItem()); qreal hlPos = listview->highlightItem()->y(); listview->setCurrentIndex(4); - QTest::qWait(500); - QCOMPARE(listview->highlightItem()->y(), hlPos); + QTRY_COMPARE(listview->highlightItem()->y(), hlPos); // insert item before currentIndex listview->setCurrentIndex(28); model.insertItem(0, "Foo", "1111"); - QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); delete canvas; } @@ -1075,35 +1029,34 @@ void tst_QDeclarativeListView::itemList() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "view"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); QDeclarativeVisualItemModel *model = canvas->rootObject()->findChild<QDeclarativeVisualItemModel*>("itemModel"); - QVERIFY(model != 0); + QTRY_VERIFY(model != 0); - QVERIFY(model->count() == 3); - QCOMPARE(listview->currentIndex(), 0); + QTRY_VERIFY(model->count() == 3); + QTRY_COMPARE(listview->currentIndex(), 0); QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "item1"); - QVERIFY(item); - QCOMPARE(item->x(), 0.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), 0.0); QDeclarativeText *text = findItem<QDeclarativeText>(viewport, "text1"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 0")); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 0")); listview->setCurrentIndex(2); - QTest::qWait(1000); item = findItem<QDeclarativeItem>(viewport, "item3"); - QVERIFY(item); - QCOMPARE(item->x(), 480.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), 480.0); text = findItem<QDeclarativeText>(viewport, "text3"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 2")); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 2")); delete canvas; } @@ -1126,35 +1079,35 @@ void tst_QDeclarativeListView::cacheBuffer() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - QVERIFY(listview->delegate() != 0); - QVERIFY(listview->model() != 0); - QVERIFY(listview->highlight() != 0); + QTRY_VERIFY(viewport != 0); + QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(listview->model() != 0); + QTRY_VERIFY(listview->highlight() != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } testObject->setCacheBuffer(400); - QVERIFY(listview->cacheBuffer() == 400); + QTRY_VERIFY(listview->cacheBuffer() == 400); int newItemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(newItemCount > itemCount); + QTRY_VERIFY(newItemCount > itemCount); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } delete canvas; @@ -1178,112 +1131,112 @@ void tst_QDeclarativeListView::positionViewAtIndex() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on a currently visible item listview->positionViewAtIndex(3, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 60.); + QTRY_COMPARE(listview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on an item beyond the visible items listview->positionViewAtIndex(22, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 440.); + QTRY_COMPARE(listview->contentY(), 440.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on an item that would leave empty space if positioned at the top listview->positionViewAtIndex(28, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 480.); + QTRY_COMPARE(listview->contentY(), 480.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position at the beginning again listview->positionViewAtIndex(0, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 0.); + QTRY_COMPARE(listview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position at End listview->positionViewAtIndex(20, QDeclarativeListView::End); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); // Position in Center listview->positionViewAtIndex(15, QDeclarativeListView::Center); - QCOMPARE(listview->contentY(), 150.); + QTRY_COMPARE(listview->contentY(), 150.); // Ensure at least partially visible listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 150.); + QTRY_COMPARE(listview->contentY(), 150.); listview->setContentY(302); listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 302.); + QTRY_COMPARE(listview->contentY(), 302.); listview->setContentY(320); listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 300.); + QTRY_COMPARE(listview->contentY(), 300.); listview->setContentY(85); listview->positionViewAtIndex(20, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 85.); + QTRY_COMPARE(listview->contentY(), 85.); listview->setContentY(75); listview->positionViewAtIndex(20, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); // Ensure completely visible listview->setContentY(120); listview->positionViewAtIndex(20, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 120.); + QTRY_COMPARE(listview->contentY(), 120.); listview->setContentY(302); listview->positionViewAtIndex(15, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 300.); + QTRY_COMPARE(listview->contentY(), 300.); listview->setContentY(85); listview->positionViewAtIndex(20, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); delete canvas; } @@ -1303,40 +1256,40 @@ void tst_QDeclarativeListView::resetModel() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(listview->count(), model.rowCount()); + QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } strings.clear(); strings << "four" << "five" << "six" << "seven"; model.setStringList(strings); - QCOMPARE(listview->count(), model.rowCount()); + QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } } void tst_QDeclarativeListView::propertyChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged())); QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged())); @@ -1346,13 +1299,13 @@ void tst_QDeclarativeListView::propertyChanges() QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged())); QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged())); - QCOMPARE(listView->highlightFollowsCurrentItem(), true); - QCOMPARE(listView->preferredHighlightBegin(), 0.0); - QCOMPARE(listView->preferredHighlightEnd(), 0.0); - QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); - QCOMPARE(listView->isWrapEnabled(), true); - QCOMPARE(listView->cacheBuffer(), 10); - QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); + QTRY_COMPARE(listView->highlightFollowsCurrentItem(), true); + QTRY_COMPARE(listView->preferredHighlightBegin(), 0.0); + QTRY_COMPARE(listView->preferredHighlightEnd(), 0.0); + QTRY_COMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); + QTRY_COMPARE(listView->isWrapEnabled(), true); + QTRY_COMPARE(listView->cacheBuffer(), 10); + QTRY_COMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -1362,21 +1315,21 @@ void tst_QDeclarativeListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QDeclarativeListView::SnapOneItem); - QCOMPARE(listView->highlightFollowsCurrentItem(), false); - QCOMPARE(listView->preferredHighlightBegin(), 1.0); - QCOMPARE(listView->preferredHighlightEnd(), 1.0); - QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); - QCOMPARE(listView->isWrapEnabled(), false); - QCOMPARE(listView->cacheBuffer(), 3); - QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); - - QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); - QCOMPARE(preferredHighlightBeginSpy.count(),1); - QCOMPARE(preferredHighlightEndSpy.count(),1); - QCOMPARE(highlightRangeModeSpy.count(),1); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(listView->highlightFollowsCurrentItem(), false); + QTRY_COMPARE(listView->preferredHighlightBegin(), 1.0); + QTRY_COMPARE(listView->preferredHighlightEnd(), 1.0); + QTRY_COMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QTRY_COMPARE(listView->isWrapEnabled(), false); + QTRY_COMPARE(listView->cacheBuffer(), 3); + QTRY_COMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); + + QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); + QTRY_COMPARE(preferredHighlightEndSpy.count(),1); + QTRY_COMPARE(highlightRangeModeSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(snapModeSpy.count(),1); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -1386,13 +1339,13 @@ void tst_QDeclarativeListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QDeclarativeListView::SnapOneItem); - QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); - QCOMPARE(preferredHighlightBeginSpy.count(),1); - QCOMPARE(preferredHighlightEndSpy.count(),1); - QCOMPARE(highlightRangeModeSpy.count(),1); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); + QTRY_COMPARE(preferredHighlightEndSpy.count(),1); + QTRY_COMPARE(highlightRangeModeSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(snapModeSpy.count(),1); delete canvas; } @@ -1400,11 +1353,11 @@ void tst_QDeclarativeListView::propertyChanges() void tst_QDeclarativeListView::componentChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QDeclarativeComponent component(canvas->engine()); component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); @@ -1422,25 +1375,25 @@ void tst_QDeclarativeListView::componentChanges() listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QCOMPARE(listView->highlight(), &component); - QCOMPARE(listView->header(), &component); - QCOMPARE(listView->footer(), &component); - QCOMPARE(listView->delegate(), &delegateComponent); + QTRY_COMPARE(listView->highlight(), &component); + QTRY_COMPARE(listView->header(), &component); + QTRY_COMPARE(listView->footer(), &component); + QTRY_COMPARE(listView->delegate(), &delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); - QCOMPARE(headerSpy.count(),1); - QCOMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); listView->setHighlight(&component); listView->setHeader(&component); listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); - QCOMPARE(headerSpy.count(),1); - QCOMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); delete canvas; } @@ -1448,28 +1401,28 @@ void tst_QDeclarativeListView::componentChanges() void tst_QDeclarativeListView::modelChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel"); - QVERIFY(alternateModel); + QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(listView, SIGNAL(modelChanged())); listView->setModel(modelVariant); - QCOMPARE(listView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(listView->model(), modelVariant); + QTRY_COMPARE(modelSpy.count(),1); listView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.count(),1); listView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.count(),2); - delete canvas; + delete canvas; } void tst_QDeclarativeListView::qListModelInterface_items() diff --git a/tests/auto/declarative/qdeclarativeloader/data/qmldir b/tests/auto/declarative/qdeclarativeloader/data/qmldir new file mode 100644 index 0000000..bf42b50 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/qmldir @@ -0,0 +1 @@ +# For tst_QDeclarativeLoader::networkRequestUrl; no types needed though. diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index 8ff2be4..96fea5b 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -9,3 +9,5 @@ SOURCES += tst_qdeclarativeloader.cpp \ DEFINES += SRCDIR=\\\"$$PWD\\\" +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index abdd210..20e709d 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -412,7 +412,9 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), QUrl("http://127.0.0.1:14445/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), QUrl(SRCDIR "/dummy.qml")); + if (component.isError()) + qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index 2f7ff82..cf3fa65 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro index 96f4454..824b402 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro @@ -4,4 +4,5 @@ SUBDIRS = plugin tst_qdeclarativemoduleplugin_pro.depends += plugin SUBDIRS += tst_qdeclarativemoduleplugin.pro +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index d01955b..48fe025 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index 043bb85..8a061c3 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeparticles.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 2f6ae32..3c327d5 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativepathview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 899c43f..b5b033a 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativepixmapcache.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index 5edfa55..dbe2cbee 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index af1e1b6..6910ccc 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro index aeccf9b..3c0f7b3 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro +++ b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepropertymap.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index aff00ad..10e10a3 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -7,3 +7,6 @@ DEFINES += SRCDIR=\\\"$$PWD\\\" # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index 132123a..abd36e0 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativerepeater.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index b41b23a..80b757d 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativesmoothedanimation.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro index f8e97a0..7f737c2 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativesmoothedfollow.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro index 61aad0f..6f400a3 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativespringfollow.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index f874803..706d045 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativestates.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro index bd4d829..87d0e5b 100644 --- a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro +++ b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro @@ -7,3 +7,5 @@ SOURCES += tst_qdeclarativestyledtext.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index 0781774..b2705fa 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative gui macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index 8b4b4d1..73c05b5 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative gui macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetext.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml index de4de00..a44e867 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml @@ -1,5 +1,4 @@ import Qt 4.6 -import "http://localhost:42332" Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index d578f68..6ef1f9f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -79,6 +79,7 @@ private slots: void inputMethodHints(); void cursorDelegate(); + void delegateLoading_data(); void delegateLoading(); void navigation(); void readOnly(); @@ -641,41 +642,60 @@ void tst_qdeclarativetextedit::cursorDelegate() QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance")); } +void tst_qdeclarativetextedit::delegateLoading_data() +{ + QTest::addColumn<QString>("qmlfile"); + QTest::addColumn<QString>("error"); + + // import installed + QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << ":-1: Network error for URL http://localhost:42332/FailItem.qml "; + QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; +} + void tst_qdeclarativetextedit::delegateLoading() { + QFETCH(QString, qmlfile); + QFETCH(QString, error); + TestHTTPServer server(42332); server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect); server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay); server.serveDirectory(SRCDIR "/data/http"); + QDeclarativeView* view = new QDeclarativeView(0); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); - view->show(); - view->setFocus(); - QTRY_VERIFY(view->rootObject());//Wait for loading to finish. - QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); - // view->rootObject()->dumpObjectTree(); - QVERIFY(textEditObject != 0); - textEditObject->setFocus(true); - QDeclarativeItem *delegate; - delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay"); - QVERIFY(delegate); - delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow"); - QVERIFY(delegate); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); - view->show(); - QTRY_VERIFY(view->status()==QDeclarativeView::Error); - view->setFocus(); - QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); + + view->setSource(QUrl(QLatin1String("http://localhost:42332/") + qmlfile)); view->show(); - QTRY_VERIFY(view->status()==QDeclarativeView::Error); view->setFocus(); - QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test + + if (!error.isEmpty()) { + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + QTRY_VERIFY(view->status()==QDeclarativeView::Error); + QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test + } else { + QTRY_VERIFY(view->rootObject());//Wait for loading to finish. + QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); + // view->rootObject()->dumpObjectTree(); + QVERIFY(textEditObject != 0); + textEditObject->setFocus(true); + QDeclarativeItem *delegate; + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay"); + QVERIFY(delegate); + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow"); + QVERIFY(delegate); + + delete delegate; + } + + //A test should be added here with a component which is ready but component.create() returns null //Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate //###This was only needed for code coverage, and could be a case of overzealous defensive programming //delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB"); //QVERIFY(!delegate); + + delete view; } /* diff --git a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml index 5773cc2..66a2017 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml @@ -1,7 +1,7 @@ import Qt 4.7 Rectangle { - property var myInput: input + property QtObject myInput: input width: 400; height: 200; color: "green" diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 5aed51f..957e75c 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -6,3 +6,4 @@ SOURCES += tst_qdeclarativetextinput.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index b162739..42604d8 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -5,3 +5,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index 028fc57..d9f1c13 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -8,3 +8,6 @@ SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 20173c6..956272f 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -7,3 +7,5 @@ SOURCES += tst_qdeclarativewebview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index e2b31c7..2e3da4d 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeworkerscript.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index 7bc92af..160300e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -11,3 +11,6 @@ SOURCES += tst_qdeclarativexmlhttprequest.cpp \ # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 88832dc..8c5052a 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -9,3 +9,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 7edf7e9..cf7e357 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -320,7 +320,21 @@ void tst_qdeclarativexmllistmodel::source() QCOMPARE(model->progress(), qreal(0.0)); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); - QTRY_COMPARE(spy.count(), 1); spy.clear(); + + QEventLoop loop; + QTimer timer; + timer.setSingleShot(true); + connect(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)), &loop, SLOT(quit())); + connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.start(20000); + loop.exec(); + + if (spy.count() == 0 && status != QDeclarativeXmlListModel::Ready) { + qWarning("QDeclarativeXmlListModel invalid source test timed out"); + } else { + QCOMPARE(spy.count(), 1); spy.clear(); + } + QCOMPARE(model->status(), status); QCOMPARE(model->count(), count); if (status == QDeclarativeXmlListModel::Ready) @@ -336,9 +350,7 @@ void tst_qdeclarativexmllistmodel::source_data() QTest::addColumn<QDeclarativeXmlListModel::Status>("status"); QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/model2.xml") << 2 << QDeclarativeXmlListModel::Ready; - - // XXX This test fails on the rare occasion due to networking, fix the test for Error status signal (323) - //QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; + QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; // empty file QTemporaryFile *temp = new QTemporaryFile(this); diff --git a/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro index 94ffe4b..988177e 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro +++ b/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro @@ -5,3 +5,4 @@ macx:CONFIG -= app_bundle SOURCES += \ tst_qmetaobjectbuilder.cpp +CONFIG += parallel_test diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index f2b3bca..a3abbe3 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlvisual.cpp DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro index f42cecc..7ffda93 100644 --- a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro @@ -5,3 +5,5 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qpacketprotocol.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test diff --git a/tests/auto/declarative/sql/sql.pro b/tests/auto/declarative/sql/sql.pro index 4217eac..7e4fdd8 100644 --- a/tests/auto/declarative/sql/sql.pro +++ b/tests/auto/declarative/sql/sql.pro @@ -7,3 +7,6 @@ SOURCES += tst_sql.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + |