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 <david.faure@kdab.com>
This commit is contained in:
Friedemann Kleint 2019-04-08 09:58:08 +02:00
parent 3a34ef636a
commit f7949df243

View File

@ -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()
{