diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-13 23:31:53 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-13 23:31:53 (GMT) |
commit | 6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126 (patch) | |
tree | c7847f428c83592747b62cef82906d458bc136c9 /tests/auto/declarative | |
parent | 9416f29a3ee7511c182eaa68f5523132ff64921d (diff) | |
parent | a5e9e86a6daddde6fb906cbf09bf562e50b17698 (diff) | |
download | Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.zip Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.tar.gz Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/examples/tst_examples.cpp | 43 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp | 12 |
2 files changed, 33 insertions, 22 deletions
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 7f4367e..dfcc9c0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -90,6 +90,12 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + +#ifdef QT_NO_WEBKIT + excludedDirs << "examples/declarative/webview"; + excludedDirs << "demos/declarative/webbrowser"; +#endif + #ifdef QT_NO_XMLPATTERNS excludedDirs << "examples/declarative/xmldata"; excludedDirs << "demos/declarative/twitter"; @@ -110,19 +116,19 @@ void tst_examples::namingConvention(const QDir &d) return; } - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); bool seenQml = !files.isEmpty(); bool seenLowercase = false; foreach (const QString &file, files) { - if (file.at(0).isLower()) + if (file.at(0).isLower()) seenLowercase = true; } if (!seenQml) { - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -153,7 +159,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) QStringList rv; - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); foreach (const QString &file, files) { if (file.at(0).isLower()) { @@ -161,7 +167,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) } } - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -175,26 +181,30 @@ QStringList tst_examples::findQmlFiles(const QDir &d) /* -This test runs all the examples in the declarative UI source tree and ensures +This test runs all the examples in the declarative UI source tree and ensures that they start and exit cleanly. Examples are any .qml files under the examples/ or demos/ directory that start -with a lower case letter. +with a lower case letter. */ #ifndef CONCURRENT void tst_examples::examples_data() { QTest::addColumn<QString>("file"); - QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); - QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); + QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; + QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; + qWarning() << examples << demos << snippets; + QStringList files; files << findQmlFiles(QDir(examples)); files << findQmlFiles(QDir(demos)); files << findQmlFiles(QDir(snippets)); + qWarning() << files; + foreach (const QString &file, files) QTest::newRow(file.toLatin1().constData()) << file; } @@ -223,7 +233,7 @@ void Example::run() 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"; @@ -238,7 +248,7 @@ void Example::run() if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); - + if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) { result = Fail; @@ -255,8 +265,8 @@ void tst_examples::examples() #ifdef CONCURRENT QThreadPool::globalInstance()->setMaxThreadCount(5); - QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); - QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); + QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; + QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; QStringList files; @@ -276,13 +286,14 @@ void tst_examples::examples() QFutureSynchronizer<void> sync; for (int ii = 0; ii < tests.count(); ++ii) { - QFuture<void> r = QtConcurrent::run(tests.at(ii), &Example::run); + Example *e = &tests[ii]; + QFuture<void> r = QtConcurrent::run(e, &Example::run); sync.addFuture(r); } sync.waitForFinished(); - for (int ii = 0; ii < tests.count(); ++ii) + for (int ii = 0; ii < tests.count(); ++ii) QVERIFY(tests.at(ii).result == Example::Pass); #else @@ -295,7 +306,7 @@ void tst_examples::examples() QFileInfo testdata(script+".qml"); QStringList arguments; arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) - << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; #ifdef Q_WS_QWS arguments << "-qws"; diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 8aeba6d..bb965a9 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -148,7 +148,7 @@ void tst_qdeclarativeborderimage::imageSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); @@ -267,14 +267,14 @@ void tst_qdeclarativeborderimage::sciSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); - + QCOMPARE(obj->source(), remote ? source : QUrl(source)); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); - + if (valid) { TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->border()->left(), 10); @@ -342,8 +342,8 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data() { QTest::addColumn<QString>("source"); - QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; - QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; + QTest::newRow("png file") << "http://localhost/none.png"; + QTest::newRow("sci file") << "http://localhost/none.sci"; } QTEST_MAIN(tst_qdeclarativeborderimage) |