From f7949df24319cda7363aed354ca6d60dc6512788 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 8 Apr 2019 09:58:08 +0200 Subject: tst_QUrl: Fix left-over temporary directory on Windows The test changes the current directory to the test directory in fromUserInputWithCwd(), but did not restore it, causing: Totals 898 passed, 0 failed, 1 skipped, 0 blacklisted, 368ms ********* Finished testing of tst_QUrl ********* QTemporaryDir Unable to remove "C:\\TEMP\\tst_qurl-ryVxqu" most likely due to the presence of read-only files. Restore the old directory at the end to fix this. Change-Id: I62669868f3c6d97dd38ebac76515428c14b7e1e7 Reviewed-by: David Faure --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/corelib/io/qurl/tst_qurl.cpp') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 4f173d2dfd..d697dae9dd 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -47,6 +47,7 @@ class tst_QUrl : public QObject private slots: void initTestCase(); + void cleanupTestCase(); void effectiveTLDs_data(); void effectiveTLDs(); void getSetCheck(); @@ -188,6 +189,7 @@ private slots: private: void testThreadingHelper(); + const QString m_currentPath = QDir::currentPath(); QTemporaryDir m_tempDir; }; @@ -196,6 +198,12 @@ void tst_QUrl::initTestCase() QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString())); } +void tst_QUrl::cleanupTestCase() +{ + // Restore working directory changed in fromUserInputWithCwd() + QDir::setCurrent(m_currentPath); +} + // Testing get/set functions void tst_QUrl::getSetCheck() { -- cgit v1.2.3