diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-04-15 09:10:43 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-04-15 09:10:43 (GMT) |
commit | 06d71fb79ad850c62a1b95fbeec607dfc4220489 (patch) | |
tree | 78698d4ab162020c725ed06fa73aa27776f3e5ec /tests/auto | |
parent | e85223d233c0e1d6beca748332b8fbaba3ebbf2d (diff) | |
parent | 2b768dc774a5a957e7806515db3c7976bb9e337c (diff) | |
download | Qt-06d71fb79ad850c62a1b95fbeec607dfc4220489.zip Qt-06d71fb79ad850c62a1b95fbeec607dfc4220489.tar.gz Qt-06d71fb79ad850c62a1b95fbeec607dfc4220489.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7
Diffstat (limited to 'tests/auto')
156 files changed, 1819 insertions, 1328 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..e62aad2 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -43,6 +43,8 @@ #include <QDir> #include <QProcess> #include <QDebug> +#include <QFutureSynchronizer> +#include <QtConcurrentRun> class tst_examples : public QObject { @@ -51,7 +53,6 @@ public: tst_examples(); private slots: - void examples_data(); void examples(); void namingConvention(); @@ -81,6 +82,15 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + + excludedDirs << "examples/declarative/imageprovider"; + excludedDirs << "demos/declarative/minehunt"; + +#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 +111,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 +154,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 +162,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,41 +173,38 @@ 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. */ -void tst_examples::examples_data() -{ - QTest::addColumn<QString>("file"); +#define THREADS 5 - QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); - QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); - QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; +struct Example { +public: + Example() : result(Unknown) {} - QStringList files; - files << findQmlFiles(QDir(examples)); - files << findQmlFiles(QDir(demos)); - files << findQmlFiles(QDir(snippets)); + enum Result { Pass, Unknown, Fail }; + Result result; + QString file; + QString qmlruntime; - foreach (const QString &file, files) - QTest::newRow(file.toLatin1().constData()) << file; -} + void run(); +}; -void tst_examples::examples() +void Example::run() { - QFETCH(QString, file); - 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" + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; #ifdef Q_WS_QWS arguments << "-qws"; @@ -205,11 +212,69 @@ void tst_examples::examples() QProcess p; p.start(qmlruntime, arguments); - QVERIFY(p.waitForFinished()); + if (!p.waitForFinished()) { + result = Fail; + return; + } + if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); - QCOMPARE(p.exitStatus(), QProcess::NormalExit); - QCOMPARE(p.exitCode(), 0); + + if (p.exitStatus() != QProcess::NormalExit || + p.exitCode() != 0) { + result = Fail; + return; + } else { + result = Pass; + return; + } +} + +void tst_examples::examples() +{ + 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(); + + QStringList failures; + for (int ii = 0; ii < tests.count(); ++ii) { + if (tests.at(ii).result != Example::Pass) + failures << QDir::cleanPath(tests.at(ii).file); + } + + if (failures.count()) { + QString error("Failed examples: "); + error += failures.join(", "); + + QFAIL(qPrintable(error)); + } + } 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/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index ee246fa..41c0a1b 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -113,7 +113,7 @@ void tst_parserstress::ecmascript() QString dataStr = QString::fromUtf8(data); - QString qml = "import Qt 4.6\n"; + QString qml = "import Qt 4.7\n"; qml+= "\n"; qml+= "QtObject {\n"; qml+= " property int test\n"; diff --git a/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml new file mode 100644 index 0000000..ba424b9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml @@ -0,0 +1,163 @@ +import Qt 4.6 +import Qt.widgets 4.7 + +Rectangle { + color: "white" + width: 240 + height: 320 + Rectangle { id: masterRect; objectName: "masterRect"; x: 26; width: 96; height: 20; color: "red" } + QGraphicsWidget { + id: rect1; objectName: "rect1" + y: 20; width: 10; height: 10 + anchors.left: masterRect.left + } + QGraphicsWidget { + id: rect2; objectName: "rect2" + y: 20; width: 10; height: 10 + anchors.left: masterRect.right + } + QGraphicsWidget { + id: rect3; objectName: "rect3" + y: 20; width: 10; height: 10 + anchors.left: masterRect.horizontalCenter + } + QGraphicsWidget { + id: rect4; objectName: "rect4" + y: 30; width: 10; height: 10 + anchors.right: masterRect.left + } + QGraphicsWidget { + id: rect5; objectName: "rect5" + y: 30; width: 10; height: 10 + anchors.right: masterRect.right + } + QGraphicsWidget { + id: rect6; objectName: "rect6" + y: 30; width: 10; height: 10 + anchors.right: masterRect.horizontalCenter + } + QGraphicsWidget { + id: rect7; objectName: "rect7" + y: 50; width: 10; height: 10 + anchors.left: parent.left + } + QGraphicsWidget { + id: rect8; objectName: "rect8" + y: 50; width: 10; height: 10 + anchors.left: parent.right + } + QGraphicsWidget { + id: rect9; objectName: "rect9" + y: 50; width: 10; height: 10 + anchors.left: parent.horizontalCenter + } + QGraphicsWidget { + id: rect10; objectName: "rect10" + y: 60; width: 10; height: 10 + anchors.right: parent.left + } + QGraphicsWidget { + id: rect11; objectName: "rect11" + y: 60; width: 10; height: 10 + anchors.right: parent.right + } + QGraphicsWidget { + id: rect12; objectName: "rect12" + y: 60; width: 10; height: 10 + anchors.right: parent.horizontalCenter + } + QGraphicsWidget { + id: rect13; objectName: "rect13" + x: 200; width: 10; height: 10 + anchors.top: masterRect.bottom + } + QGraphicsWidget { + id: rect14; objectName: "rect14" + width: 10; height: 10; + anchors.verticalCenter: parent.verticalCenter + } + QGraphicsWidget { + id: rect15; objectName: "rect15" + y: 200; height: 10 + anchors.left: masterRect.left + anchors.right: masterRect.right + } + QGraphicsWidget { + id: rect16; objectName: "rect16" + y: 220; height: 10 + anchors.left: masterRect.left + anchors.horizontalCenter: masterRect.right + } + QGraphicsWidget { + id: rect17; objectName: "rect17" + y: 240; height: 10 + anchors.right: masterRect.right + anchors.horizontalCenter: masterRect.left + } + QGraphicsWidget { + id: rect18; objectName: "rect18" + x: 180; width: 10 + anchors.top: masterRect.bottom + anchors.bottom: rect12.top + } + QGraphicsWidget { + id: rect19; objectName: "rect19" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.horizontalCenter + } + QGraphicsWidget { + id: rect20; objectName: "rect20" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.right + } + QGraphicsWidget { + id: rect21; objectName: "rect21" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.left + } + QGraphicsWidget { + id: rect22; objectName: "rect22" + width: 10; height: 10 + anchors.centerIn: masterRect + } + QGraphicsWidget { + id: rect23; objectName: "rect23" + anchors.left: masterRect.left + anchors.leftMargin: 5 + anchors.right: masterRect.right + anchors.rightMargin: 5 + anchors.top: masterRect.top + anchors.topMargin: 5 + anchors.bottom: masterRect.bottom + anchors.bottomMargin: 5 + } + QGraphicsWidget { + id: rect24; objectName: "rect24" + width: 10; height: 10 + anchors.horizontalCenter: masterRect.left + anchors.horizontalCenterOffset: width/2 + } + QGraphicsWidget { + id: rect25; objectName: "rect25" + width: 10; height: 10 + anchors.verticalCenter: rect12.top + anchors.verticalCenterOffset: height/2 + } + Rectangle { + id: rect26; objectName: "rect26" + width: 10; height: 10 + anchors.baseline: masterRect.top + anchors.baselineOffset: height/2 + } + Text { + id: text1; objectName: "text1" + y: 200; + text: "Hello" + } + Text { + id: text2; objectName: "text2" + anchors.baseline: text1.baseline + anchors.left: text1.right + text: "World" + } +} 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/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 9eaa400..01b5bc5 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include <qtest.h> #include <QSignalSpy> +#include <QtGui/QGraphicsWidget> +#include <private/qgraphicsitem_p.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeview.h> @@ -59,9 +61,11 @@ public: template<typename T> T *findItem(QGraphicsObject *parent, const QString &id); + QGraphicsObject *findObject(QGraphicsObject *parent, const QString &objectName); private slots: void basicAnchors(); + void basicAnchorsQGraphicsWidget(); void loops(); void illegalSets(); void illegalSets_data(); @@ -99,6 +103,25 @@ T *tst_qdeclarativeanchors::findItem(QGraphicsObject *parent, const QString &obj return 0; } +QGraphicsObject *tst_qdeclarativeanchors::findObject(QGraphicsObject *parent, const QString &objectName) +{ + QList<QGraphicsItem *> children = parent->childItems(); + for (int i = 0; i < children.count(); ++i) { + QGraphicsObject *item = children.at(i)->toGraphicsObject(); + if (item) { + if (objectName.isEmpty() || item->objectName() == objectName) { + return item; + } + item = findObject(item, objectName); + if (item) + return item; + } + } + + return 0; +} + + void tst_qdeclarativeanchors::basicAnchors() { QDeclarativeView *view = new QDeclarativeView; @@ -166,6 +189,73 @@ void tst_qdeclarativeanchors::basicAnchors() delete view; } +void tst_qdeclarativeanchors::basicAnchorsQGraphicsWidget() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorsqgraphicswidget.qml")); + + qApp->processEvents(); + + //sibling horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect1"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect2"))->x(), 122.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect3"))->x(), 74.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect4"))->x(), 16.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect5"))->x(), 112.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect6"))->x(), 64.0); + + //parent horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect7"))->x(), 0.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect8"))->x(), 240.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect9"))->x(), 120.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect10"))->x(), -10.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect11"))->x(), 230.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect12"))->x(), 110.0); + + //vertical + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect13"))->y(), 20.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect14"))->y(), 155.0); + + //stretch + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect15"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect15"))->property("width").toReal(), 96.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect16"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect16"))->property("width").toReal(), 192.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect17"))->x(), -70.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect17"))->property("width").toReal(), 192.0); + + //vertical stretch + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect18"))->y(), 20.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect18"))->property("height").toReal(), 40.0); + + //more parent horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect19"))->x(), 115.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect20"))->x(), 235.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect21"))->x(), -5.0); + + //centerIn + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect22"))->x(), 69.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect22"))->y(), 5.0); + + //margins + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->x(), 31.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->y(), 5.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->property("width").toReal(), 86.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->property("height").toReal(), 10.0); + + // offsets + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect24"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect25"))->y(), 60.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect26"))->y(), 5.0); + + //baseline + QDeclarativeText *text1 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text1")); + QDeclarativeText *text2 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text2")); + QCOMPARE(text1->y(), text2->y()); + + delete view; +} + // mostly testing that we don't crash void tst_qdeclarativeanchors::loops() { @@ -207,7 +297,7 @@ void tst_qdeclarativeanchors::illegalSets() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\n" + qml.toUtf8()), QUrl::fromLocalFile("")); if (!component.isReady()) qWarning() << "Test errors:" << component.errors(); QVERIFY(component.isReady()); 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/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 39ce9eb..0fb080c 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -141,12 +141,12 @@ void tst_qdeclarativeanimatedimage::remote() QFETCH(QString, fileName); QFETCH(bool, paused); - TestHTTPServer server(14445); + TestHTTPServer server(14449); QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14445/" + fileName)); + QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName)); TRY_WAIT(component.isReady()); QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); @@ -196,7 +196,7 @@ void tst_qdeclarativeanimatedimage::invalidSource() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); 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/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index f018ce1..959cc19 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -648,7 +648,7 @@ void tst_qdeclarativeanimations::easingProperties() { { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QString componentStr = "import Qt 4.7\nNumberAnimation { easing.type: \"InOutQuad\" }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -659,7 +659,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -671,7 +671,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -684,7 +684,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); 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..0f03527 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -55,8 +55,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14446 +#define SERVER_ADDR "http://127.0.0.1:14446" #define TRY_WAIT(expr) \ do { \ @@ -99,7 +99,7 @@ tst_qdeclarativeborderimage::tst_qdeclarativeborderimage() void tst_qdeclarativeborderimage::noSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -143,12 +143,12 @@ void tst_qdeclarativeborderimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); @@ -170,7 +170,7 @@ void tst_qdeclarativeborderimage::imageSource() void tst_qdeclarativeborderimage::clearSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -190,7 +190,7 @@ void tst_qdeclarativeborderimage::clearSource() void tst_qdeclarativeborderimage::resized() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -205,7 +205,7 @@ void tst_qdeclarativeborderimage::resized() void tst_qdeclarativeborderimage::smooth() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -222,7 +222,7 @@ void tst_qdeclarativeborderimage::smooth() void tst_qdeclarativeborderimage::tileModes() { { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -235,7 +235,7 @@ void tst_qdeclarativeborderimage::tileModes() delete obj; } { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -262,19 +262,19 @@ void tst_qdeclarativeborderimage::sciSource() server->serveDirectory(SRCDIR "/data"); } - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); 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); @@ -307,7 +307,7 @@ void tst_qdeclarativeborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -325,7 +325,7 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest() { QFETCH(QString, source); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -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/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index ae62363..35cffdc 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -228,7 +228,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property variant test: " #name " }", QUrl()); \ + component.setData("import Qt 4.7; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -278,7 +278,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -290,7 +290,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: b }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -304,7 +304,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: e.a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -318,7 +318,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -332,7 +332,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -380,7 +380,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -412,7 +412,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); @@ -432,7 +432,7 @@ void tst_qdeclarativecontext::idAsContextProperty() void tst_qdeclarativecontext::readOnlyContexts() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: me }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: me }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); 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/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index d0eb90e..133dcb8 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -822,7 +822,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QList<QByteArray> qml; - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {" "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" @@ -832,7 +832,7 @@ int main(int argc, char *argv[]) "}" "}"; // add second component to test multiple root contexts - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {}"; tst_QDeclarativeDebug_Factory factory; return QDeclarativeDebugTest::runTests(&factory, qml); 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/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index d391941..1f0c47c 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -81,7 +81,7 @@ private: void tst_qdeclarativedom::loadSimple() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -94,13 +94,13 @@ void tst_qdeclarativedom::loadSimple() QVERIFY(!rootObject.isCustomType()); QVERIFY(rootObject.objectType() == "Qt/Item"); QVERIFY(rootObject.objectTypeMajorVersion() == 4); - QVERIFY(rootObject.objectTypeMinorVersion() == 6); + QVERIFY(rootObject.objectTypeMinorVersion() == 7); } // Test regular properties void tst_qdeclarativedom::loadProperties() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { id : item; x : 300; visible : true }"; QDeclarativeDomDocument document; @@ -134,7 +134,7 @@ void tst_qdeclarativedom::loadProperties() void tst_qdeclarativedom::loadGroupedProperties() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { anchors.left: parent.left; anchors.right: parent.right }"; QDeclarativeDomDocument document; @@ -177,7 +177,7 @@ void tst_qdeclarativedom::loadGroupedProperties() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { \n" " anchors {\n" " left: parent.left\n" @@ -228,7 +228,7 @@ void tst_qdeclarativedom::loadGroupedProperties() void tst_qdeclarativedom::loadChildObject() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { Item {} }"; QDeclarativeDomDocument document; @@ -273,7 +273,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; to: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; @@ -291,7 +291,7 @@ void tst_qdeclarativedom::testValueSource() QVERIFY(valueSourceObject.isValid()); QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); - + const QDeclarativeDomValue springValue = valueSourceObject.property("spring").value(); QVERIFY(!springValue.isInvalid()); QVERIFY(springValue.isLiteral()); @@ -305,7 +305,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; @@ -332,7 +332,7 @@ void tst_qdeclarativedom::testValueInterceptor() // Test QDeclarativeDomDocument::imports() void tst_qdeclarativedom::loadImports() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "import importlib.sublib 1.1\n" "import importlib.sublib 1.0 as NewFoo\n" "import 'import'\n" @@ -350,7 +350,7 @@ void tst_qdeclarativedom::loadImports() QCOMPARE(import.type(), QDeclarativeDomImport::Library); QCOMPARE(import.uri(), QLatin1String("Qt")); QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.6")); + QCOMPARE(import.version(), QLatin1String("4.7")); import = document.imports().at(1); QCOMPARE(import.type(), QDeclarativeDomImport::Library); @@ -380,7 +380,7 @@ void tst_qdeclarativedom::loadImports() // Test loading a file with errors void tst_qdeclarativedom::loadErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " foo: 12\n" "}"; @@ -400,7 +400,7 @@ void tst_qdeclarativedom::loadErrors() // Test loading a file with syntax errors void tst_qdeclarativedom::loadSyntaxErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "asdf"; QDeclarativeDomDocument document; @@ -415,10 +415,10 @@ void tst_qdeclarativedom::loadSyntaxErrors() QCOMPARE(error.description(), QString("Syntax error")); } -// Test attempting to load a file with remote references +// Test attempting to load a file with remote references void tst_qdeclarativedom::loadRemoteErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Script {\n" " source: \"http://localhost/exampleQmlScript.js\"" @@ -440,7 +440,7 @@ void tst_qdeclarativedom::loadRemoteErrors() void tst_qdeclarativedom::loadDynamicProperty() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" " property bool b\n" @@ -488,7 +488,7 @@ void tst_qdeclarativedom::loadDynamicProperty() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a: 12\n" " property int b: a + 6\n" @@ -502,7 +502,7 @@ void tst_qdeclarativedom::loadDynamicProperty() QVERIFY(rootObject.isValid()); QCOMPARE(rootObject.dynamicProperties().count(), 3); - + { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(0); QVERIFY(d.isDefaultProperty() == false); @@ -532,7 +532,7 @@ void tst_qdeclarativedom::loadComponent() { // Explicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Component {\n" " id: myComponent\n" @@ -563,7 +563,7 @@ void tst_qdeclarativedom::loadComponent() QVERIFY(component.isValid()); QVERIFY(component.objectType() == "Qt/Component"); QVERIFY(component.objectTypeMajorVersion() == 4); - QVERIFY(component.objectTypeMinorVersion() == 6); + QVERIFY(component.objectTypeMinorVersion() == 7); QVERIFY(component.objectClassName() == "Component"); QVERIFY(component.objectId() == "myComponent"); QVERIFY(component.properties().isEmpty()); @@ -580,7 +580,7 @@ void tst_qdeclarativedom::loadComponent() // Implicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "ListView {\n" " delegate: Item {}\n" "}"; @@ -630,7 +630,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, no dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -645,7 +645,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" "}"; @@ -683,7 +683,7 @@ void tst_qdeclarativedom::object_property() // Valid object - no default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -723,7 +723,7 @@ void tst_qdeclarativedom::object_property() // Valid object - with default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -760,7 +760,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(y.value().toLiteral().literal() == "12"); QCOMPARE(y.position(), 35); QCOMPARE(y.length(), 1); - + QDeclarativeDomProperty data = rootObject.property("data"); QVERIFY(data.isValid()); QVERIFY(data.propertyName() == "data"); @@ -782,9 +782,9 @@ void tst_qdeclarativedom::object_url() QCOMPARE(object.url(), QUrl()); } - // Valid builtin object + // Valid builtin object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -797,7 +797,7 @@ void tst_qdeclarativedom::object_url() // Valid composite object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {}"; QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); @@ -815,7 +815,7 @@ void tst_qdeclarativedom::object_url() // Test copy constructors and operators void tst_qdeclarativedom::copy() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {\n" " id: myItem\n" " property int a: 10\n" @@ -1029,7 +1029,7 @@ void tst_qdeclarativedom::copy() QDeclarativeDomObject object = document.rootObject(); QDeclarativeDomProperty property = object.property("data"); QCOMPARE(property.value().toList().values().count(), 1); - QDeclarativeDomComponent component = + QDeclarativeDomComponent component = property.value().toList().values().at(0).toObject().toComponent(); QCOMPARE(component.componentRoot().objectClassName(), QByteArray("Item")); @@ -1190,7 +1190,7 @@ void tst_qdeclarativedom::copy() // Tests the position/length of various elements void tst_qdeclarativedom::position() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " id: myItem\n" " property int a: 10\n" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml new file mode 100644 index 0000000..86c312c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Item { + property int children: root.children.length +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml new file mode 100644 index 0000000..a762d6d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id: root + + Item {} + + SpuriousWarning {} +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml new file mode 100644 index 0000000..a52c772 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml @@ -0,0 +1,9 @@ +import Qt 4.6 + +Item { + id: root + + property int childrenCount: root.children.length + + Item {} +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml new file mode 100644 index 0000000..9ac4430 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + onBasicSignal: print("Hello world!"); +} 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/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c9fb116..35b4d99 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -141,6 +141,8 @@ private slots: void deletedEngine(); void libraryScriptAssert(); void variantsAssignedUndefined(); + void qtbug_9792(); + void noSpuriousWarningsAtShutdown(); void callQtInvokables(); private: @@ -2211,6 +2213,67 @@ void tst_qdeclarativeecmascript::variantsAssignedUndefined() delete object; } +void tst_qdeclarativeecmascript::qtbug_9792() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_9792.qml")); + + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context)); + QVERIFY(object != 0); + + QTest::ignoreMessage(QtDebugMsg, "Hello world!"); + object->basicSignal(); + + delete context; + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + object->basicSignal(); + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + + delete object; +} + +// Test that we shut down without stupid warnings +void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.qml")); + + QObject *o = component.create(); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete o; + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } + + + { + QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.2.qml")); + + QObject *o = component.create(); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete o; + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" 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/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 5dc5f19..5d8a52d 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -192,7 +192,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 10\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 10\n}\n"); file.close(); } @@ -209,7 +209,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 11\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 11\n}\n"); file.close(); } 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/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index cb87977..a345a60 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -147,7 +147,7 @@ void tst_qdeclarativeflickable::properties() void tst_qdeclarativeflickable::overShoot() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(overShootChanged())); @@ -170,7 +170,7 @@ void tst_qdeclarativeflickable::overShoot() void tst_qdeclarativeflickable::maximumFlickVelocity() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); @@ -187,7 +187,7 @@ void tst_qdeclarativeflickable::maximumFlickVelocity() void tst_qdeclarativeflickable::flickDeceleration() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); @@ -204,7 +204,7 @@ void tst_qdeclarativeflickable::flickDeceleration() void tst_qdeclarativeflickable::pressDelay() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); 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/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 375e801..5cdc96c 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -45,7 +45,7 @@ #include "../../../shared/util.h" #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14448 class tst_qdeclarativefontloader : public QObject @@ -79,7 +79,7 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() : void tst_qdeclarativefontloader::noFont() { - QString componentStr = "import Qt 4.6\nFontLoader { }"; + QString componentStr = "import Qt 4.7\nFontLoader { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -94,7 +94,7 @@ void tst_qdeclarativefontloader::noFont() void tst_qdeclarativefontloader::namedFont() { - QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { name: \"Helvetica\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -107,7 +107,7 @@ void tst_qdeclarativefontloader::namedFont() void tst_qdeclarativefontloader::localFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -120,7 +120,7 @@ void tst_qdeclarativefontloader::localFont() void tst_qdeclarativefontloader::failLocalFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -134,7 +134,7 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -150,7 +150,7 @@ void tst_qdeclarativefontloader::redirWebFont() { server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/olddir/oldname.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -164,8 +164,8 @@ void tst_qdeclarativefontloader::redirWebFont() void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/nonexist.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14445/nonexist.ttf\" ) "); + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14448/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); 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..89be151 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,17 +818,17 @@ 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("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); @@ -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/data/aspectratio.qml b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml new file mode 100644 index 0000000..402d33e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +Image { + source: "heart.png" + fillMode: Image.PreserveAspectFit; +} 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/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ec9f4ec..53c208e 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -46,6 +46,7 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> #include <private/qdeclarativeimage_p.h> #include <private/qdeclarativeimagebase_p.h> #include <private/qdeclarativeloader_p.h> @@ -54,8 +55,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14451 +#define SERVER_ADDR "http://127.0.0.1:14451" #define TRY_WAIT(expr) \ do { \ @@ -80,6 +81,7 @@ private slots: void imageSource_data(); void clearSource(); void resized(); + void preserveAspectRatio(); void smooth(); void pixmap(); void svg(); @@ -95,7 +97,7 @@ tst_qdeclarativeimage::tst_qdeclarativeimage() void tst_qdeclarativeimage::noSource() { - QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -149,7 +151,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -179,7 +181,7 @@ void tst_qdeclarativeimage::imageSource() void tst_qdeclarativeimage::clearSource() { - QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -201,7 +203,7 @@ void tst_qdeclarativeimage::clearSource() void tst_qdeclarativeimage::resized() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -209,13 +211,34 @@ void tst_qdeclarativeimage::resized() QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); - delete obj; } + +void tst_qdeclarativeimage::preserveAspectRatio() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->show(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + QDeclarativeImage *image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + QVERIFY(image != 0); + image->setWidth(80.0); + QCOMPARE(image->width(), 80.); + QCOMPARE(image->height(), 80.); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + image->setHeight(60.0); + QVERIFY(image != 0); + QCOMPARE(image->height(), 60.); + QCOMPARE(image->width(), 60.); + delete canvas; +} + void tst_qdeclarativeimage::smooth() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -230,7 +253,7 @@ void tst_qdeclarativeimage::smooth() void tst_qdeclarativeimage::pixmap() { - QString componentStr = "import Qt 4.6\nImage { pixmap: testPixmap }"; + QString componentStr = "import Qt 4.7\nImage { pixmap: testPixmap }"; QPixmap pixmap; QDeclarativeContext *ctxt = engine.rootContext(); @@ -261,7 +284,7 @@ void tst_qdeclarativeimage::pixmap() void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -300,7 +323,7 @@ void tst_qdeclarativeimage::big() // have to build a 400 MB image. That would be a bug in the JPEG loader. QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); 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/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index fe5f5a2..162c266 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -114,7 +114,7 @@ void tst_qdeclarativeimageprovider::imageSource() engine.addImageProvider("test", new TestProvider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; " + properties + " }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; " + properties + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -145,7 +145,7 @@ void tst_qdeclarativeimageprovider::removeProvider() QVERIFY(engine.imageProvider("test2") != 0); // add provider, confirm it works - QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"image://test2/exists1.png\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); 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/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index a6171ae..4400116 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -293,7 +293,7 @@ void tst_QDeclarativeItem::keyNavigation() void tst_QDeclarativeItem::smooth() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Item { smooth: false; }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QSignalSpy spy(item, SIGNAL(smoothChanged(bool))); @@ -322,7 +322,7 @@ void tst_QDeclarativeItem::smooth() void tst_QDeclarativeItem::clip() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { clip: false\n }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QSignalSpy spy(item, SIGNAL(clipChanged(bool))); @@ -426,7 +426,7 @@ void tst_QDeclarativeItem::transforms() QFETCH(QByteArray, qml); QFETCH(QMatrix, matrix); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QVERIFY(item); QCOMPARE(item->sceneMatrix(), matrix); 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..7c327c2 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(); @@ -1254,12 +1257,12 @@ void tst_qdeclarativelanguage::importsLocal_data() << "QDeclarativeRectangle" << ""; QTest::newRow("local import second") - << "import Qt 4.6\nimport \"subdir\"\n" + << "import Qt 4.7\nimport \"subdir\"\n" "Test {}" << "QDeclarativeRectangle" << ""; QTest::newRow("local import subsubdir") - << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" + << "import Qt 4.7\nimport \"subdir/subsubdir\"\n" "SubTest {}" << "QDeclarativeRectangle" << ""; @@ -1298,13 +1301,47 @@ 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:14447/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(14447); + 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"); QTest::addColumn<QString>("type"); QTest::addColumn<QString>("error"); - QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; + QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage"; QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle" << ""; @@ -1320,15 +1357,13 @@ void tst_qdeclarativelanguage::importsRemote_data() << "UndeclaredLocal is not a type"; } -#include "testhttpserver.h" - void tst_qdeclarativelanguage::importsRemote() { QFETCH(QString, qml); QFETCH(QString, type); QFETCH(QString, error); - TestHTTPServer server(14445); + TestHTTPServer server(14447); server.serveDirectory(SRCDIR); testType(qml,type,error); @@ -1430,24 +1465,24 @@ void tst_qdeclarativelanguage::importsOrder_data() QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" - "import Qt 4.6\n" + "import Qt 4.7\n" "Rectangle {}" << "QDeclarativeRectangle" << ""; QTest::newRow("installed import versus builtin 2") << - "import Qt 4.6\n" + "import Qt 4.7\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "QDeclarativeText" << ""; QTest::newRow("namespaces cannot be overridden by types 1") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "" << "Namespace Rectangle cannot be used as a type"; QTest::newRow("namespaces cannot be overridden by types 2") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" << "QDeclarativeImage" @@ -1502,7 +1537,7 @@ void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() void tst_qdeclarativelanguage::crash1() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nComponent {}", QUrl()); + component.setData("import Qt 4.7\nComponent {}", QUrl()); } void tst_qdeclarativelanguage::crash2() 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/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 5962a42..9d61ad0 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -118,7 +118,7 @@ void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item) void tst_QDeclarativeListModel::static_i18n() { QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; + QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); @@ -139,7 +139,7 @@ void tst_QDeclarativeListModel::static_nestedElements() QString elementsStr = elements.join(",\n") + "\n"; QString componentStr = - "import Qt 4.6\n" + "import Qt 4.7\n" "ListModel {\n" " ListElement {\n" " attributes: [\n"; @@ -468,7 +468,7 @@ void tst_QDeclarativeListModel::static_types() QFETCH(QString, qml); QFETCH(QVariant, value); - qml = "import Qt 4.6\nListModel { " + qml + " }"; + qml = "import Qt 4.7\nListModel { " + qml + " }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); @@ -500,35 +500,35 @@ void tst_QDeclarativeListModel::error_data() QTest::addColumn<QString>("error"); QTest::newRow("id not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "import Qt 4.7\nListModel { ListElement { id: fred } }" << "ListElement: cannot use reserved \"id\" property"; QTest::newRow("id allowed in ListModel") - << "import Qt 4.6\nListModel { id:model }" + << "import Qt 4.7\nListModel { id:model }" << ""; QTest::newRow("random properties not allowed in ListModel") - << "import Qt 4.6\nListModel { foo:123 }" + << "import Qt 4.7\nListModel { foo:123 }" << "ListModel: undefined property 'foo'"; QTest::newRow("random properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << "import Qt 4.7\nListModel { ListElement { foo:123 } }" << ""; QTest::newRow("bindings not allowed in ListElement") - << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" + << "import Qt 4.7\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" << "ListElement: cannot use script for property value"; QTest::newRow("random object list properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << "import Qt 4.7\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" << ""; QTest::newRow("default properties not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "import Qt 4.7\nListModel { ListElement { Item { } } }" << "ListElement: cannot contain nested elements"; QTest::newRow("QML elements not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { a: Item { } } }" + << "import Qt 4.7\nListModel { ListElement { a: Item { } } }" << "ListElement: cannot contain nested elements"; } 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/data/strictlyenforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml new file mode 100644 index 0000000..6fc41fa --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +ListView { + id: list + objectName: "list" + width: 320 + height: 480 + + function fillModel() { + list.model.append({"col": "red"}); + list.currentIndex = list.count-1 + list.model.append({"col": "blue"}); + list.currentIndex = list.count-1 + list.model.append({"col": "green"}); + list.currentIndex = list.count-1 + } + + model: ListModel { id: listModel } // empty model + delegate: Rectangle { id: wrapper; objectName: "wrapper"; color: col; width: 300; height: 400 } + orientation: "Horizontal" + snapMode: "SnapToItem" + cacheBuffer: 1000 + + preferredHighlightBegin: 10 + preferredHighlightEnd: 10 + + highlightRangeMode: "StrictlyEnforceRange" + focus: true +} 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..6b7a361 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 { @@ -88,6 +89,7 @@ private slots: void propertyChanges(); void componentChanges(); void modelChanges(); + void QTBUG_9791(); private: template <class T> void items(); @@ -325,62 +327,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 +405,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 +441,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 +525,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 +586,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 +612,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 +654,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 +688,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 +723,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 +772,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 +819,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 +852,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 +874,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 +951,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 +994,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 +1030,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 +1080,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 +1132,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 +1257,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 +1300,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 +1316,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 +1340,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,17 +1354,17 @@ 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("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); @@ -1422,25 +1376,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,30 +1402,68 @@ 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; +} + +void tst_QDeclarativeListView::QTBUG_9791() +{ + QDeclarativeView *canvas = createView(); + + QDeclarativeContext *ctxt = canvas->rootContext(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject()); + QTRY_VERIFY(listview != 0); - delete canvas; + QDeclarativeItem *viewport = listview->viewport(); + QTRY_VERIFY(viewport != 0); + QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(listview->model() != 0); + + QMetaObject::invokeMethod(listview, "fillModel"); + qApp->processEvents(); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 3); + + for (int i = 0; i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), i*300.0); + } + + // check that view is positioned correctly + QTRY_COMPARE(listview->contentX(), 590.0); + + delete canvas; } + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); 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..4a82b50 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -48,7 +48,7 @@ #include <private/qdeclarativeloader_p.h> #include "testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14450 inline QUrl TEST_FILE(const QString &filename) { @@ -104,7 +104,7 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() void tst_QDeclarativeLoader::url() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); @@ -141,7 +141,7 @@ void tst_QDeclarativeLoader::invalidUrl() QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item() == 0); @@ -157,7 +157,7 @@ void tst_QDeclarativeLoader::clear() { QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" " Loader { id: loader\n" " source: 'Rect120x60.qml'\n" " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" @@ -203,7 +203,7 @@ void tst_QDeclarativeLoader::clear() void tst_QDeclarativeLoader::urlToComponent() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + component.setData(QByteArray("import Qt 4.7\n" "Loader {\n" " id: loader\n" " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" @@ -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.7\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + if (component.isError()) + qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); @@ -434,8 +436,8 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" - "import \"http://127.0.0.1:14445/\" as NW\n" + "import Qt 4.7\n" + "import \"http://127.0.0.1:14450/\" as NW\n" "Item {\n" " Component { id: comp; NW.SlowRect {} }\n" " Loader { sourceComponent: comp } }") @@ -463,10 +465,10 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); + QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) "); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), QUrl("http://127.0.0.1:14445/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); @@ -516,8 +518,9 @@ void tst_QDeclarativeLoader::nonItem() void tst_QDeclarativeLoader::vmeErrors() { QDeclarativeComponent component(&engine, TEST_FILE("vmeErrors.qml")); - QString err = QString("(") + QUrl::fromLocalFile(SRCDIR).toString() + QString("/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); - QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); + //ignore message for now + //QString err = QUrl::fromLocalFile(SRCDIR "/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); + //QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader); QVERIFY(loader->item() == 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/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 4d43c68..df7c511 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -632,7 +632,7 @@ void tst_QDeclarativePathView::componentChanges() QVERIFY(pathView); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 899c43f..4b247fc 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -5,5 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepixmapcache.cpp +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h +SOURCES += ../shared/testhttpserver.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" + # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 223f54f..f2ccf80 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -43,6 +43,8 @@ #include <private/qdeclarativepixmapcache_p.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QNetworkReply> +#include "testhttpserver.h" +#include "../../../shared/util.h" // These don't let normal people run tests! //#include "../network-settings.h" @@ -52,8 +54,10 @@ class tst_qdeclarativepixmapcache : public QObject Q_OBJECT public: tst_qdeclarativepixmapcache() : - thisfile(QUrl::fromLocalFile(__FILE__)) + thisfile(QUrl::fromLocalFile(__FILE__)), + server(14452) { + server.serveDirectory(SRCDIR "/data/http"); } private slots: @@ -65,6 +69,7 @@ private slots: private: QDeclarativeEngine engine; QUrl thisfile; + TestHTTPServer server; }; @@ -110,8 +115,8 @@ void tst_qdeclarativepixmapcache::single_data() // File URLs are optimized QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false; QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true; + QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/exists.png") << false << true << false; + QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/notexists.png") << false << false << true; } void tst_qdeclarativepixmapcache::single() @@ -122,7 +127,7 @@ void tst_qdeclarativepixmapcache::single() QFETCH(bool, neterror); if (neterror) { - QString expected = "\"Error downloading " + target.toString() + " - server replied: Not Found\" "; + QString expected = "\"Error downloading " + target.toString() + " - server replied: Not found\" "; QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); } else if (!exists) { QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) "; @@ -183,32 +188,32 @@ void tst_qdeclarativepixmapcache::parallel_data() ; QTest::newRow("remote") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << QUrl("http://127.0.0.1:14452/exists2.png") + << QUrl("http://127.0.0.1:14452/exists3.png") << 0 << -1 << 2 ; QTest::newRow("remoteagain") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << QUrl("http://127.0.0.1:14452/exists2.png") + << QUrl("http://127.0.0.1:14452/exists3.png") << 2 << -1 << 0 ; QTest::newRow("remotecopy") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") + << QUrl("http://127.0.0.1:14452/exists4.png") + << QUrl("http://127.0.0.1:14452/exists4.png") << 0 << -1 << 1 ; QTest::newRow("remotecopycancel") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") + << QUrl("http://127.0.0.1:14452/exists5.png") + << QUrl("http://127.0.0.1:14452/exists5.png") << 0 << 0 << 1 @@ -233,6 +238,7 @@ void tst_qdeclarativepixmapcache::parallel() QPixmap pixmap; QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap); QDeclarativePixmapReply *reply = 0; + QVERIFY(status != QDeclarativePixmapReply::Error); if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready) reply = QDeclarativePixmapCache::request(&engine, target); replies.append(reply); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml new file mode 100644 index 0000000..052d96b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml @@ -0,0 +1,40 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Grid { + objectName: "grid" + columns: 0 + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/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/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 08eac0a..8692596 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -63,6 +63,7 @@ private slots: void test_grid(); void test_grid_spacing(); void test_grid_animated(); + void test_grid_zero_columns(); void test_propertychanges(); void test_repeater(); void test_flow(); @@ -414,6 +415,38 @@ void tst_QDeclarativePositioners::test_grid_animated() QTRY_COMPARE(five->y(), 50.0); } + +void tst_QDeclarativePositioners::test_grid_zero_columns() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/gridzerocolumns.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 70.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 120.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 0.0); + QCOMPARE(five->y(), 50.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QCOMPARE(grid->width(), 170.0); + QCOMPARE(grid->height(), 60.0); +} + void tst_QDeclarativePositioners::test_propertychanges() { QDeclarativeView *canvas = createView(SRCDIR "/data/propertychangestest.qml"); 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/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index c996a14..f1d3bf0 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -138,7 +138,7 @@ void tst_QDeclarativePropertyMap::changed() QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty(QLatin1String("testdata"), &map); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + component.setData("import Qt 4.7\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QDeclarativeText *txt = qobject_cast<QDeclarativeText*>(component.create()); @@ -179,7 +179,7 @@ void tst_QDeclarativePropertyMap::crashBug() context.setContextProperty("map", &map); QDeclarativeComponent c(&engine); - c.setData("import Qt 4.6\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); + c.setData("import Qt 4.7\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); QObject *obj = c.create(&context); delete obj; } 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/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 419f5ea..8be7d80 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -354,7 +354,7 @@ void tst_QDeclarativeRepeater::properties() QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); QDeclarativeComponent rectComponent(&engine); - rectComponent.setData("import Qt 4.6; Rectangle {}", QUrl::fromLocalFile("")); + rectComponent.setData("import Qt 4.7; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); QCOMPARE(delegateSpy.count(),1); 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/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 5c93952..7927d97 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -70,7 +70,7 @@ tst_qdeclarativesystempalette::tst_qdeclarativesystempalette() void tst_qdeclarativesystempalette::activePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -99,7 +99,7 @@ void tst_qdeclarativesystempalette::activePalette() void tst_qdeclarativesystempalette::inactivePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Inactive }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -129,7 +129,7 @@ void tst_qdeclarativesystempalette::inactivePalette() void tst_qdeclarativesystempalette::disabledPalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Disabled }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -159,7 +159,7 @@ void tst_qdeclarativesystempalette::disabledPalette() void tst_qdeclarativesystempalette::paletteChanged() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); 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/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index bf7d110..2d10756 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -156,7 +156,7 @@ void tst_qdeclarativetext::text() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -168,7 +168,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -181,7 +181,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -198,7 +198,7 @@ void tst_qdeclarativetext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -214,7 +214,7 @@ void tst_qdeclarativetext::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = qCeil(metricWidth); - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -234,7 +234,7 @@ void tst_qdeclarativetext::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -251,7 +251,7 @@ void tst_qdeclarativetext::wrap() // for specified width and wrap set true { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); textHeight = textObject->height(); @@ -262,7 +262,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -278,7 +278,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -300,7 +300,7 @@ void tst_qdeclarativetext::elide() { QDeclarativeComponent textComponent(&engine); - textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); + textComponent.setData(("import Qt 4.7\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -309,7 +309,7 @@ void tst_qdeclarativetext::elide() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -321,7 +321,7 @@ void tst_qdeclarativetext::elide() // richtext - does nothing for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -336,7 +336,7 @@ void tst_qdeclarativetext::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -344,7 +344,7 @@ void tst_qdeclarativetext::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -361,7 +361,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -374,7 +374,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -393,7 +393,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -407,7 +407,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -423,7 +423,7 @@ void tst_qdeclarativetext::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -434,7 +434,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pixelSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -445,7 +445,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -455,7 +455,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -465,7 +465,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -476,7 +476,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -490,7 +490,7 @@ void tst_qdeclarativetext::style() //test style for (int i = 0; i < styles.size(); i++) { - QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -505,7 +505,7 @@ void tst_qdeclarativetext::color() //test style for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -516,7 +516,7 @@ void tst_qdeclarativetext::color() for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -530,7 +530,7 @@ void tst_qdeclarativetext::color() { for (int j = 0; j < colorStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -544,7 +544,7 @@ void tst_qdeclarativetext::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -558,14 +558,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < standard.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -575,14 +575,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < richText.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -594,7 +594,7 @@ void tst_qdeclarativetext::smooth() void tst_qdeclarativetext::weight() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -603,7 +603,7 @@ void tst_qdeclarativetext::weight() QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Normal); } { - QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -616,7 +616,7 @@ void tst_qdeclarativetext::weight() void tst_qdeclarativetext::underline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -625,7 +625,7 @@ void tst_qdeclarativetext::underline() QCOMPARE(textObject->font().underline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.underline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -638,7 +638,7 @@ void tst_qdeclarativetext::underline() void tst_qdeclarativetext::overline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -647,7 +647,7 @@ void tst_qdeclarativetext::overline() QCOMPARE(textObject->font().overline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.overline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -660,7 +660,7 @@ void tst_qdeclarativetext::overline() void tst_qdeclarativetext::strikeout() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -669,7 +669,7 @@ void tst_qdeclarativetext::strikeout() QCOMPARE(textObject->font().strikeOut(), false); } { - QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.strikeout: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -682,7 +682,7 @@ void tst_qdeclarativetext::strikeout() void tst_qdeclarativetext::capitalization() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -691,7 +691,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::MixedCase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -700,7 +700,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllUppercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -709,7 +709,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllLowercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -718,7 +718,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::SmallCaps); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -731,7 +731,7 @@ void tst_qdeclarativetext::capitalization() void tst_qdeclarativetext::letterSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -740,7 +740,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -749,7 +749,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -762,7 +762,7 @@ void tst_qdeclarativetext::letterSpacing() void tst_qdeclarativetext::wordSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -771,7 +771,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -780,7 +780,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -811,7 +811,7 @@ public slots: void tst_qdeclarativetext::clickLink() { { - QString componentStr = "import Qt 4.6\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); 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..25101ba 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(); @@ -149,7 +150,7 @@ void tst_qdeclarativetextedit::text() { { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -158,7 +159,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -169,7 +170,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -189,7 +190,7 @@ void tst_qdeclarativetextedit::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -203,7 +204,7 @@ void tst_qdeclarativetextedit::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = floor(metricWidth); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -220,7 +221,7 @@ void tst_qdeclarativetextedit::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -235,7 +236,7 @@ void tst_qdeclarativetextedit::wrap() // for specified width and wrap set true { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -244,7 +245,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -255,7 +256,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -270,7 +271,7 @@ void tst_qdeclarativetextedit::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); @@ -278,7 +279,7 @@ void tst_qdeclarativetextedit::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); @@ -295,7 +296,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -309,7 +310,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -329,7 +330,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -343,7 +344,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -359,7 +360,7 @@ void tst_qdeclarativetextedit::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -371,7 +372,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -382,7 +383,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -393,7 +394,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -405,7 +406,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -420,7 +421,7 @@ void tst_qdeclarativetextedit::color() //test normal for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -432,7 +433,7 @@ void tst_qdeclarativetextedit::color() //test selection for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -443,7 +444,7 @@ void tst_qdeclarativetextedit::color() //test selected text for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -456,7 +457,7 @@ void tst_qdeclarativetextedit::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -469,7 +470,7 @@ void tst_qdeclarativetextedit::color() void tst_qdeclarativetextedit::textMargin() { for(qreal i=0; i<=10; i+=0.3){ - QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -481,7 +482,7 @@ void tst_qdeclarativetextedit::textMargin() void tst_qdeclarativetextedit::persistentSelection() { { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -490,7 +491,7 @@ void tst_qdeclarativetextedit::persistentSelection() } { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -502,7 +503,7 @@ void tst_qdeclarativetextedit::persistentSelection() void tst_qdeclarativetextedit::focusOnPress() { { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -511,7 +512,7 @@ void tst_qdeclarativetextedit::focusOnPress() } { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -523,7 +524,7 @@ void tst_qdeclarativetextedit::focusOnPress() void tst_qdeclarativetextedit::selection() { QString testStr = standard[0];//TODO: What should happen for multiline/rich text? - QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \""+ testStr +"\"; }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -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/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 9a66a36..fcd7527 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -109,7 +109,7 @@ void tst_qdeclarativetextinput::text() { { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -120,7 +120,7 @@ void tst_qdeclarativetextinput::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -138,7 +138,7 @@ void tst_qdeclarativetextinput::width() // uses Font metrics to find the width for standard { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -153,7 +153,7 @@ void tst_qdeclarativetextinput::width() QFontMetricsF fm(f); qreal metricWidth = fm.width(standard.at(i)); - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -169,7 +169,7 @@ void tst_qdeclarativetextinput::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -183,7 +183,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -196,7 +196,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -209,7 +209,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -223,7 +223,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -240,7 +240,7 @@ void tst_qdeclarativetextinput::color() //test color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -253,7 +253,7 @@ void tst_qdeclarativetextinput::color() //test selection color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -266,7 +266,7 @@ void tst_qdeclarativetextinput::color() //test selected text color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -281,7 +281,7 @@ void tst_qdeclarativetextinput::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -296,7 +296,7 @@ void tst_qdeclarativetextinput::color() void tst_qdeclarativetextinput::selection() { QString testStr = standard[0]; - QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \""+ testStr +"\"; }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -378,7 +378,7 @@ void tst_qdeclarativetextinput::selection() void tst_qdeclarativetextinput::maxLength() { - //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; + //QString componentStr = "import Qt 4.7\nTextInput { maximumLength: 10; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); canvas->show(); canvas->setFocus(); @@ -408,7 +408,7 @@ void tst_qdeclarativetextinput::maxLength() void tst_qdeclarativetextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) - //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; + //QString componentStr = "import Qt 4.7\nTextInput { inputMask: 'HHHHhhhh'; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); canvas->show(); canvas->setFocus(); 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/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp index 1dfec50..a08a91c 100644 --- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -93,7 +93,7 @@ void tst_qdeclarativetimer::notRepeating() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -114,7 +114,7 @@ void tst_qdeclarativetimer::notRepeatingStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -139,7 +139,7 @@ void tst_qdeclarativetimer::repeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -181,7 +181,7 @@ void tst_qdeclarativetimer::triggeredOnStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -216,7 +216,7 @@ void tst_qdeclarativetimer::triggeredOnStartRepeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -240,7 +240,7 @@ void tst_qdeclarativetimer::noTriggerIfNotRunning() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" "Item { property bool ok: true\n" "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" "Timer { interval: 10; running: true; onTriggered: t1.running=false }" @@ -258,7 +258,7 @@ void tst_qdeclarativetimer::changeDuration() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -294,7 +294,7 @@ void tst_qdeclarativetimer::restart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); 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/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index ce389f3..beabf86 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -453,7 +453,7 @@ void tst_qdeclarativewebview::newWindowComponent() QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeComponent substituteComponent(&engine); - substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + substituteComponent.setData("import Qt 4.7; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); 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/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index fe2dac2..a1dae24 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -85,7 +85,7 @@ void tst_QDeclarativeWorkerScript::source() QUrl source = QUrl::fromLocalFile(SRCDIR "/data/worker.qml"); QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + component.setData("import Qt 4.7\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); QDeclarativeWorkerScript *item = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(item != 0); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect index f43e043..4d21122 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect @@ -1,9 +1,9 @@ PUT /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 9 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml index d7b9266..729793e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml @@ -13,6 +13,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", urlDummy); x.setRequestHeader("Test-header", "TestValue"); + x.setRequestHeader("Accept-Language", "en-US"); x.send(); x.onreadystatechange = function() { @@ -35,6 +36,7 @@ QtObject { } } x.open("PUT", url); + x.setRequestHeader("Accept-Language", "en-US"); x.send("Test Data"); } } diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml index 72a45e7..33ca020 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml @@ -21,10 +21,12 @@ QtObject { readyState = true; x.open("PUT", url); + x.setRequestHeader("Accept-Language", "en-US"); x.abort(); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml index aa78cde..c0957ed 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml @@ -21,6 +21,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml index 8d67fad..9096999 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml @@ -31,6 +31,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml index 2f949e1..7a65e25 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml @@ -37,6 +37,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml index c06bae3..72fb9d7 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml @@ -20,6 +20,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml index 19e37fa..b07f8e7 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml @@ -20,6 +20,7 @@ QtObject { readyState = true; x.open("GET", url, true, "username", "password"); + x.setRequestHeader("Accept-Language","en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml index 4bb3a7a..9fa4847 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml @@ -22,6 +22,7 @@ QtObject { unsent = (x.responseText == ""); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); opened = (x.responseText == ""); @@ -39,6 +40,7 @@ QtObject { dataOK = (x.responseText == expectedText); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); reset = (x.responseText == ""); } diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml index 0bad7df..a9ef3e8 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml @@ -7,6 +7,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("GET", "testdocument.html"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect index 81dd4a0..2effbdc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect @@ -1,9 +1,9 @@ POST /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml index 03543a9..171e0b1 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml @@ -8,6 +8,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("POST", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml index 79a27b6..09b742b 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml index e048769..8786917 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain;charset=latin1"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect index 8fcf3ac..8336860 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect @@ -1,9 +1,9 @@ POST /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: charset=UTF-8;text/plain Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml index 7ab0b27..6789480 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "charset=UTF-8;text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml index 29bf2c2..08d999d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "charset=latin1;text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect index 97e6fac..4f10bbc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect @@ -1,9 +1,9 @@ PUT /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml index 135f45c..e047fc8 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml @@ -8,6 +8,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("PUT", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml index 4a09527..ba0db25 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml index dd5fa46..ddf520e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml @@ -9,6 +9,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open(reqType, url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect index 991bd59..74a9798 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect @@ -1,7 +1,7 @@ HEAD /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect index 4600f2a..7b8e260 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect @@ -1,9 +1,9 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US TEST-HEADER: value TEST-HEADER2: value,value2 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml index b0723aa..61eea33 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); x.setRequestHeader("Test-header", "value"); x.setRequestHeader("Test-header2", "value"); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml index bf31eca..b22b239 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml @@ -21,6 +21,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); x.setRequestHeader(header, "Value"); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml index c2bbc6e..666c791 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml @@ -10,6 +10,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml index 04202c4..c903e12 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml @@ -27,6 +27,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.status; @@ -54,6 +55,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.status; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml index 8becc3b..a3b98be 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml @@ -27,6 +27,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.statusText; @@ -54,6 +55,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.statusText; 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/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 13ed959..1d26f2c 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -55,12 +55,6 @@ public: tst_qdeclarativexmlhttprequest() {} private slots: - void initTestCase() { - if (QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')) != QLatin1String("en-US")) { - qWarning() << "Test will fail unless LANG is en_US"; - } - } - void domExceptionCodes(); void callbackException(); void callbackException_data(); 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/fillmode/data/fillmode.qml b/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml index 7ac6f51..08ed609 100644 --- a/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml +++ b/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml @@ -6,274 +6,6 @@ VisualTest { } Frame { msec: 16 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 32 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 48 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 64 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 80 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 96 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 112 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 128 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 144 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 160 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 176 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 192 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 208 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 224 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 240 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 256 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 272 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 288 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 304 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 320 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 336 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 352 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 368 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 384 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 400 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 416 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 432 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 448 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 464 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 480 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 496 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 512 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 528 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 544 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 560 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 576 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 592 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 608 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 624 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 640 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 656 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 672 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 688 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 704 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Key { - type: 6 - key: 16777249 - modifiers: 0 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 720 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 736 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 752 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 768 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 784 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 800 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 816 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 832 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 848 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 864 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 880 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 896 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 912 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 928 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 944 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 960 image: "fillmode.0.png" - } - Frame { - msec: 976 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 992 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1008 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1024 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1040 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1056 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } + } } 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/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 05c2ebd..718e3a6 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -47,7 +47,7 @@ #include <QProcess> #include <QFile> -enum Mode { Record, RecordNoVisuals, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; +enum Mode { Record, RecordNoVisuals, RecordSnapshot, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; static QString testdir; class tst_qmlvisual : public QObject @@ -133,7 +133,7 @@ void tst_qmlvisual::visual() QStringList arguments; arguments << "-script" << testdata << "-scriptopts" << "play,testimages,testerror,exitoncomplete,exitonfailure" - << file << "-graphicssystem" << "raster"; + << file; #ifdef Q_WS_QWS arguments << "-qws"; #endif @@ -246,6 +246,11 @@ void action(Mode mode, const QString &file) << "-scriptopts" << "record,saveonexit" << file; break; + case RecordSnapshot: + arguments << "-script" << testdata + << "-scriptopts" << "record,testimages,snapshot,saveonexit" + << file; + break; case Play: arguments << "-script" << testdata << "-scriptopts" << "play,testimages,testerror,exitoncomplete" @@ -283,6 +288,7 @@ void usage() fprintf(stderr, " -listtests : list all the tests seen by tst_qmlvisual, and then exit immediately\n"); fprintf(stderr, " -record file : record new test data for file\n"); fprintf(stderr, " -recordnovisuals file : record new test data for file, but ignore visuals\n"); + fprintf(stderr, " -recordsnapshot file : record new snapshot for file (like record but only records a single frame and then exits)\n"); fprintf(stderr, " -play file : playback test data for file, printing errors\n"); fprintf(stderr, " -testvisuals file : playback test data for file, without errors\n"); fprintf(stderr, " -updatevisuals file : playback test data for file, accept new visuals for file\n"); @@ -340,6 +346,9 @@ int main(int argc, char **argv) } else if (arg == "-recordnovisuals" && (ii + 1) < argc) { mode = RecordNoVisuals; file = argv[++ii]; + } else if (arg == "-recordsnapshot" && (ii + 1) < argc) { + mode = RecordSnapshot; + file = argv[++ii]; } else if (arg == "-testvisuals" && (ii + 1) < argc) { mode = TestVisuals; file = argv[++ii]; 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 + diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 1bab2d2..c8b8dc3 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -196,7 +196,7 @@ void tst_sql::testQml() QFETCH(QString, jsfile); QString qml= - "import Qt 4.6\n" + "import Qt 4.7\n" "import \""+jsfile+"\" as JS\n" "Text { text: JS.test() }"; |