summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/examples
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-04-13 06:41:59 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-04-13 06:42:47 (GMT)
commit7544b0ddf02c5302eed430452efc5da311d8b1c7 (patch)
treebac424ec464511853ba9bef6aee12dffa46f1297 /tests/auto/declarative/examples
parent38ddecfd87399ed92729f122d940cce812c44ec2 (diff)
downloadQt-7544b0ddf02c5302eed430452efc5da311d8b1c7.zip
Qt-7544b0ddf02c5302eed430452efc5da311d8b1c7.tar.gz
Qt-7544b0ddf02c5302eed430452efc5da311d8b1c7.tar.bz2
Use SRCDIR to make examples test work with shadow builds.
Diffstat (limited to 'tests/auto/declarative/examples')
-rw-r--r--tests/auto/declarative/examples/tst_examples.cpp34
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 7f4367e..edf74ec 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;
@@ -282,7 +286,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
@@ -295,7 +299,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";