diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-13 06:53:18 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-13 06:53:18 (GMT) |
commit | ed5cbe3cc5d57360c205d22deb8bb77063227b8f (patch) | |
tree | 508cf4323e9fe9cf4e3a82de114d7cc10fcfa42c /tests/auto/declarative/examples | |
parent | 00b802ca9b2b09bc0357bc4b8f213657e24b02f8 (diff) | |
parent | 7544b0ddf02c5302eed430452efc5da311d8b1c7 (diff) | |
download | Qt-ed5cbe3cc5d57360c205d22deb8bb77063227b8f.zip Qt-ed5cbe3cc5d57360c205d22deb8bb77063227b8f.tar.gz Qt-ed5cbe3cc5d57360c205d22deb8bb77063227b8f.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/declarative/examples')
-rw-r--r-- | tests/auto/declarative/examples/tst_examples.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index ae74fc0..3e5c0ae 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -110,19 +110,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 +153,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 +161,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 +175,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 +227,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 +242,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 +259,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; @@ -283,7 +287,7 @@ void tst_examples::examples() 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 @@ -296,7 +300,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"; |