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>
This commit is contained in:
parent
97eec16e4f
commit
096cdb3c04
@ -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/
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user