summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfilesystemmodel
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@nokia.com>2010-02-02 15:44:28 +0100
committerRobert Loehning <robert.loehning@nokia.com>2010-02-02 15:51:55 +0100
commitfc92419c2058b8c3af8fc1c723e9d957118bcb8f (patch)
tree1a06b76613057e0f2b768b5e038ee6fc546d4c09 /tests/auto/qfilesystemmodel
parent0a2daeed026eca14bafe8463c7d0e629fd196c59 (diff)
Expanded tst_QFileSystemModel::rootPath() to check directories ending in "." or ".."
Reviewed-by: Jan-Arve
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 287f472853..9f67a5e425 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -236,6 +236,26 @@ void tst_QFileSystemModel::rootPath()
QCOMPARE(model->rootPath(), QString(QDir::homePath()));
QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? 0 : 1);
QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath());
+
+ model->setRootPath(QDir::rootPath());
+ int oldCount = rootChanged.count();
+ oldRootPath = model->rootPath();
+ root = model->setRootPath(QDir::homePath() + QLatin1String("/."));
+ QTRY_VERIFY(model->rowCount(root) >= 0);
+ QCOMPARE(model->rootPath(), QDir::homePath());
+ QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? oldCount : oldCount + 1);
+ QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath());
+
+ QDir newdir = QDir::home();
+ if (newdir.cdUp()) {
+ oldCount = rootChanged.count();
+ oldRootPath = model->rootPath();
+ root = model->setRootPath(QDir::homePath() + QLatin1String("/.."));
+ QTRY_VERIFY(model->rowCount(root) >= 0);
+ QCOMPARE(model->rootPath(), newdir.path());
+ QCOMPARE(rootChanged.count(), oldCount + 1);
+ QCOMPARE(model->rootDirectory().absolutePath(), newdir.path());
+ }
}
void tst_QFileSystemModel::naturalCompare_data()