diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2012-02-27 11:11:10 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-13 05:13:50 +0100 |
commit | 340c479bb17c8c14013cedd7c8eece30bf206c89 (patch) | |
tree | ddabf7d901e3063f8bf4b35054767f6cdc39d878 /src/qmltest | |
parent | 656d1a147db433518236ad886074d27ed20e70ec (diff) |
Only attempt to load QML test cases from source directory if it exists.
When running installed unit tests the QML test cases are likely not
in the source directory, but in the same directory as the installed
test binary. If the source directory does not exist, fall back to
searching for QML test cases in the current directory.
Change-Id: I231b9cd49b12d88dd6cfbcc8dfb8b6c2c69d5aad
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/quicktest.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 2e32a60b2d..1c69cee456 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -203,8 +203,11 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport } // Determine where to look for the test data. - if (testPath.isEmpty() && sourceDir) - testPath = QString::fromLocal8Bit(sourceDir); + if (testPath.isEmpty() && sourceDir) { + const QString s = QString::fromLocal8Bit(sourceDir); + if (QFile::exists(s)) + testPath = s; + } if (testPath.isEmpty()) { QDir current = QDir::current(); #ifdef Q_OS_WIN |