diff options
author | Robert Loehning <robert.loehning@nokia.com> | 2010-02-02 14:44:28 (GMT) |
---|---|---|
committer | Robert Loehning <robert.loehning@nokia.com> | 2010-02-02 14:51:55 (GMT) |
commit | fc92419c2058b8c3af8fc1c723e9d957118bcb8f (patch) | |
tree | 1a06b76613057e0f2b768b5e038ee6fc546d4c09 | |
parent | 0a2daeed026eca14bafe8463c7d0e629fd196c59 (diff) | |
download | Qt-fc92419c2058b8c3af8fc1c723e9d957118bcb8f.zip Qt-fc92419c2058b8c3af8fc1c723e9d957118bcb8f.tar.gz Qt-fc92419c2058b8c3af8fc1c723e9d957118bcb8f.tar.bz2 |
Expanded tst_QFileSystemModel::rootPath() to check directories ending in "." or ".."
Reviewed-by: Jan-Arve
-rw-r--r-- | tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index 287f472..9f67a5e 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() |