summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-12-15 12:44:44 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-12-15 12:44:44 +1000
commitca2133ab144a78269b27231bbc3cfd75c5911df6 (patch)
treeef8c6f5311e8f5cb14c2bc0dbe2c4218ea491c67 /src
parent55959eddf9286ce76f25c7e157f7b726862b328e (diff)
Deprecate running tests from resources
Too much house-keeping is needed to run tests from resources, so start the process of removing support to discourage the creation of poor test harnesses.
Diffstat (limited to 'src')
-rw-r--r--src/quicktestlib/quicktest.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/quicktestlib/quicktest.cpp b/src/quicktestlib/quicktest.cpp
index 19e8605..bed13b1 100644
--- a/src/quicktestlib/quicktest.cpp
+++ b/src/quicktestlib/quicktest.cpp
@@ -134,10 +134,7 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
argv[outargc] = 0;
argc = outargc;
- // Determine where to look for the test data. If QUICK_TEST_SOURCE_DIR
- // is set, then use that. Otherwise scan the application's resources.
- if (testPath.isEmpty())
- testPath = QString::fromLocal8Bit(qgetenv("QUICK_TEST_SOURCE_DIR"));
+ // Determine where to look for the test data.
if (testPath.isEmpty() && sourceDir)
testPath = QString::fromLocal8Bit(sourceDir);
if (testPath.isEmpty())
@@ -152,6 +149,21 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
QDirIterator::FollowSymlinks);
while (iter.hasNext())
files += iter.next();
+ if (testPath == QLatin1String(":/")) {
+ if (files.isEmpty()) {
+ // No QML tests in the program resources - search "." instead.
+ testPath = QLatin1String(".");
+ QDirIterator iter(testPath, filters, QDir::Files,
+ QDirIterator::Subdirectories |
+ QDirIterator::FollowSymlinks);
+ while (iter.hasNext())
+ files += iter.next();
+ } else {
+ qWarning() << argv[0]
+ << ": test cases in resources are deprecated and will "
+ "be removed soon";
+ }
+ }
files.sort();
// Bail out if we didn't find any test cases.