summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfilesystemmodel
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-10-14 09:37:50 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-10-14 09:39:04 (GMT)
commit09afb304b21be21864036d39522d4418fe243b0b (patch)
tree2fc712377bd2e05140d16ed552bf7ab3c6eeacf6 /tests/auto/qfilesystemmodel
parentf151424797794cba5a3fdaf628eabaa75a5e7801 (diff)
downloadQt-09afb304b21be21864036d39522d4418fe243b0b.zip
Qt-09afb304b21be21864036d39522d4418fe243b0b.tar.gz
Qt-09afb304b21be21864036d39522d4418fe243b0b.tar.bz2
Make the test working on random directories so we are sure there was
no crap before. Reviewed-by:ogoffart
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 3b24352..f2d9017 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -806,21 +806,13 @@ void tst_QFileSystemModel::sort()
myModel->d_func()->disableRecursiveSort = true;
QDir dir(QDir::tempPath());
- dir.mkdir("sortTemp");
- dir.cd("sortTemp");
+ //initialize the randomness
+ qsrand(QDateTime::currentDateTime().toTime_t());
+ QString tempName = QLatin1String("sortTemp.") + QString::number(qrand());
+ dir.mkdir(tempName);
+ dir.cd(tempName);
QTRY_VERIFY(dir.exists());
- //To be sure we clean the dir if it was there before
- QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot);
- while(it.hasNext())
- {
- it.next();
- QFileInfo info = it.fileInfo();
- if (info.isDir())
- dir.rmdir(info.fileName());
- else
- QFile::remove(info.absoluteFilePath());
- }
const QString dirPath = dir.absolutePath();
QVERIFY(dir.exists());
@@ -882,11 +874,11 @@ void tst_QFileSystemModel::sort()
delete myModel;
dir.setPath(QDir::tempPath());
- dir.cd("sortTemp");
+ dir.cd(tempName);
tempFile.remove();
tempFile2.remove();
dir.cdUp();
- dir.rmdir("sortTemp");
+ dir.rmdir(tempName);
}