diff options
author | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2015-12-11 13:42:28 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2016-01-21 05:53:17 +0000 |
commit | f05c597ae506ea6163394dbb6b70ecc77fae3b3c (patch) | |
tree | 02a3b3644bd9c0657aed855d7d348d527cdbefce /tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | |
parent | f4502fbaf0d31d08bf08f1685f1d7b30735b72b4 (diff) |
winrt: msvc2015: refactor file handling
msvc2015 reintroduced a couple of functions from the win32 API
towards WinRT.
Enable usage of those and simplify the file system engine.
Furthermore update the autotests.
Change-Id: I9eafffba0ddfd05917c184c4a6b9e166f86d71d9
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp')
-rw-r--r-- | tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 94e6bbaade..6e461cae17 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -85,10 +85,15 @@ private slots: void QTBUG_4796_data(); void QTBUG_4796(); void guaranteeUnique(); +private: + QString m_previousCurrent; }; void tst_QTemporaryFile::initTestCase() { + m_previousCurrent = QDir::currentPath(); + QDir::setCurrent(QDir::tempPath()); + // For QTBUG_4796 QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); @@ -116,6 +121,8 @@ void tst_QTemporaryFile::cleanupTestCase() { // From QTBUG_4796 QVERIFY(QDir().rmdir("test-XXXXXX")); + + QDir::setCurrent(m_previousCurrent); } void tst_QTemporaryFile::construction() @@ -678,8 +685,11 @@ void tst_QTemporaryFile::createNativeFile_data() const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); #endif - QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); - QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); + // File might not exist locally in case of sandboxing or remote testing + if (!nativeFilePath.startsWith(QLatin1String(":/"))) { + QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); + QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); + } QTest::newRow("resourceFile") << ":/resources/test.txt" << (qint64)-1 << true << QByteArray("This is a test"); QTest::newRow("resourceFileWithPos") << ":/resources/test.txt" << (qint64)5 << true << QByteArray("This is a test"); } |