Fix tst_QDir::emptyDir

It is possible that tmpdir already exists as a leftover from previous
tests. That is no reason for the test to fail.

Change-Id: I010633fb92defb064093af9872ae6fd2178f07dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Oliver Wolff 2017-05-11 11:50:11 +02:00
parent 8e776d39ff
commit 5441f399af

View File

@ -2322,8 +2322,11 @@ void tst_QDir::cdBelowRoot()
void tst_QDir::emptyDir()
{
const QString tempDir = QDir::currentPath() + "/tmpdir/";
QVERIFY(QDir().mkdir(tempDir));
QVERIFY(QDir(tempDir).mkdir("emptyDirectory"));
QDir temp(tempDir);
if (!temp.exists()) {
QVERIFY(QDir().mkdir(tempDir));
}
QVERIFY(temp.mkdir("emptyDirectory"));
QDir testDir(tempDir + "emptyDirectory");
QVERIFY(testDir.isEmpty());