From ca2133ab144a78269b27231bbc3cfd75c5911df6 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 15 Dec 2010 12:44:44 +1000 Subject: 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. --- src/quicktestlib/quicktest.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') 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. -- cgit v1.2.3