summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/largefile/tst_largefile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/largefile/tst_largefile.cpp')
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index 52f6e13376..e448093062 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -65,7 +65,7 @@ public:
, fd_(-1)
, stream_(0)
{
- #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC)
+ #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
maxSizeBits = 36; // 64 GiB
#elif defined(Q_OS_MAC)
// HFS+ does not support sparse files, so we limit file size for the test
@@ -130,6 +130,9 @@ private:
int fd_;
FILE *stream_;
+
+ QSharedPointer<QTemporaryDir> m_tempDir;
+ QString m_previousCurrent;
};
/*
@@ -224,6 +227,11 @@ QByteArray const &tst_LargeFile::getDataBlock(int index, qint64 position)
void tst_LargeFile::initTestCase()
{
+ m_previousCurrent = QDir::currentPath();
+ m_tempDir = QSharedPointer<QTemporaryDir>(new QTemporaryDir);
+ QVERIFY2(!m_tempDir.isNull(), qPrintable("Could not create temporary directory."));
+ QVERIFY2(QDir::setCurrent(m_tempDir->path()), qPrintable("Could not switch current directory"));
+
QFile file("qt_largefile.tmp");
QVERIFY( !file.exists() || file.remove() );
}
@@ -235,6 +243,8 @@ void tst_LargeFile::cleanupTestCase()
QFile file("qt_largefile.tmp");
QVERIFY( !file.exists() || file.remove() );
+
+ QDir::setCurrent(m_previousCurrent);
}
void tst_LargeFile::init()