diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-10-11 14:35:58 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-10-11 15:43:26 (GMT) |
commit | 7f8af7a2030c0f4ae7ad79eee93bd68a29f285d3 (patch) | |
tree | eab2bef61618de1cd0c239cde418913ca46e37c9 | |
parent | a3427f351c1cfde94c5d55c03ba1a82c56d9b53d (diff) | |
download | Qt-7f8af7a2030c0f4ae7ad79eee93bd68a29f285d3.zip Qt-7f8af7a2030c0f4ae7ad79eee93bd68a29f285d3.tar.gz Qt-7f8af7a2030c0f4ae7ad79eee93bd68a29f285d3.tar.bz2 |
Add test to test QDir caching behavior.
Also fix the qfileenginemodel test to be less fragile
Reviewed-by: Prasanth Ullattil
-rw-r--r-- | tests/auto/qdir/tst_qdir.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 2bb0a3e..d540f29 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -175,6 +175,8 @@ private slots: void detachingOperations(); + void testCaching(); + #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) void isRoot_data(); void isRoot(); @@ -1663,6 +1665,17 @@ void tst_QDir::detachingOperations() QCOMPARE(dir1.sorting(), sorting); } +void tst_QDir::testCaching() +{ + QString dirName = QString::fromLatin1("testCaching"); + QDir::current().rmdir(dirName); // cleanup a previous run. + QDir dir(dirName); + QVERIFY(!dir.exists()); + QDir::current().mkdir(dirName); + QVERIFY(QDir(dirName).exists()); // dir exists + QVERIFY(dir.exists()); // QDir doesn't cache the 'exist' between calls. +} + #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) void tst_QDir::isRoot_data() { diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index c234c96..aa632c7 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -992,8 +992,8 @@ void tst_QFileSystemModel::dirsBeforeFiles() } dir.rmdir(dirPath); } - dir.mkpath(dirPath); - QVERIFY(dir.exists()); + QVERIFY(dir.mkpath(dirPath)); + QVERIFY(QDir(dirPath).exists()); for (int i = 0; i < 3; ++i) { QLatin1Char c('a' + i); |