summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfilesystemmodel
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-10-19 04:58:20 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-10-19 04:58:20 (GMT)
commit91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d (patch)
tree499f3a3e0ba67c76da18a33fd331569670578a79 /tests/auto/qfilesystemmodel
parent4a0e3170c779a6a37954c3dfcfd0b9f0ce144701 (diff)
parentc3bab81d5966c9bd3a42d9c5cbb9d8ad35a1b330 (diff)
downloadQt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.zip
Qt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.tar.gz
Qt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 29e4fe6..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());
@@ -874,7 +866,7 @@ void tst_QFileSystemModel::sort()
} else {
for(int i = 0; i < myModel->rowCount(parent); ++i)
{
- QVERIFY(dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString() == expectedOrder.at(i));
+ QTRY_COMPARE(dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString(), expectedOrder.at(i));
}
}
@@ -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);
}