diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2017-06-02 14:38:17 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2017-06-19 07:05:57 +0000 |
commit | 096cdb3c04b13be811fc2a5a23deec2a69dc65a4 (patch) | |
tree | 5ba0056ae1ed8507333aa70a178ecd667647ffab /tests/auto/corelib | |
parent | 97eec16e4ff6367c233f8ea6c4a343c286c3a514 (diff) |
Fix tst_qfile::size for configurations using builtin test data
As the files are packaged into the binary, they have to be
extracted, before they can be ::open'ed.
Change-Id: Ie83086a2b9a73b6b0de462bdb52a71bb277ae06f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/io/qfile/test/test.pro | 6 | ||||
-rw-r--r-- | tests/auto/corelib/io/qfile/tst_qfile.cpp | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index 7ad047e8a2..1472ddbb83 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -4,6 +4,12 @@ QT = core-private core testlib qtHaveModule(network): QT += network else: DEFINES += QT_NO_NETWORK +contains(CONFIG, builtin_testdata) { + DEFINES += BUILTIN_TESTDATA +} + +TESTDATA += ../BLACKLIST + TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp INCLUDEPATH += ../../../../../shared/ diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 9751bb4c9e..c7216dc169 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -250,6 +250,9 @@ private slots: void reuseQFile(); private: +#ifdef BUILTIN_TESTDATA + QSharedPointer<QTemporaryDir> m_dataDir; +#endif enum FileType { OpenQFile, OpenFd, @@ -428,8 +431,15 @@ void tst_QFile::initTestCase() QVERIFY(!m_forRenamingFile.isEmpty()); m_twoDotsFile = QFINDTESTDATA("two.dots.file"); QVERIFY(!m_twoDotsFile.isEmpty()); + +#ifndef BUILTIN_TESTDATA m_testFile = QFINDTESTDATA("testfile.txt"); QVERIFY(!m_testFile.isEmpty()); +#else + m_dataDir = QEXTRACTTESTDATA("/"); + QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data")); + m_testFile = m_dataDir->path() + "/testfile.txt"; +#endif m_resourcesDir = QFINDTESTDATA("resources"); QVERIFY(!m_resourcesDir.isEmpty()); m_noEndOfLineFile = QFINDTESTDATA("noendofline.txt"); |