diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2017-11-08 12:12:06 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2017-11-09 07:33:35 +0000 |
commit | bbc68dc815122e6be9ea44adadd93ffb715c7792 (patch) | |
tree | 38975de35010c1099fb69207e51689fbf3006bbd /tests | |
parent | e27bd981373cc3d22e54d8cbe030e5c329f9beda (diff) |
Fix tst_QFile::useQFileInAFileHandler for systems using resources for test data
Resource files are extracted to m_dataDir in tst_QFile::initTestCase.
Instead of trying to access the file from the resource on systems that
use qrc for bundling the test data, we have to use the files that were
extracted at the beginning of the test.
Change-Id: I35453fbdeb27e317d1342ff1cb7bbea9cebea14d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qfile/tst_qfile.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 8db89b9f05..8a3d490925 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2190,12 +2190,20 @@ public: if (fileName.startsWith(":!")) { QDir dir; - QString realFile = QFINDTESTDATA(fileName.mid(2)); +#ifndef BUILTIN_TESTDATA + const QString realFile = QFINDTESTDATA(fileName.mid(2)); +#else + const QString realFile = m_dataDir->filePath(fileName.mid(2)); +#endif if (dir.exists(realFile)) return new QFSFileEngine(realFile); } return 0; } + +#ifdef BUILTIN_TESTDATA + QSharedPointer<QTemporaryDir> m_dataDir; +#endif }; #endif @@ -2204,6 +2212,9 @@ void tst_QFile::useQFileInAFileHandler() { // This test should not dead-lock MyRecursiveHandler handler; +#ifdef BUILTIN_TESTDATA + handler.m_dataDir = m_dataDir; +#endif QFile file(":!tst_qfile.cpp"); QVERIFY(file.exists()); } |