summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdir
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdir')
-rw-r--r--tests/auto/qdir/tst_qdir.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 71469bb..b2dc960 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -172,6 +172,11 @@ private slots:
void longFileName();
void updateFileLists();
+
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ void isRoot_data();
+ void isRoot();
+#endif
};
// Testing get/set functions
@@ -805,6 +810,16 @@ void tst_QDir::canonicalPath_data()
QTest::newRow("absPath") << appPath + "\\testData\\..\\testData" << appPath + "/testData";
#endif
QTest::newRow("nonexistant") << "testd" << QString();
+
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QTest::newRow("drive:/") << QDir::rootPath() << QDir::rootPath();
+ QTest::newRow("drive:\\") << QDir::toNativeSeparators(QDir::rootPath()) << QDir::rootPath();
+ QTest::newRow("drive:/./") << QDir::rootPath().append("./") << QDir::rootPath();
+ QTest::newRow("drive:/../.. ") << QDir::rootPath().append("../..") << QDir::rootPath();
+ QTest::newRow("drive:\\.\\") << QDir::toNativeSeparators(QDir::rootPath().append("./")) << QDir::rootPath();
+ QTest::newRow("drive:\\..\\..") << QDir::toNativeSeparators(QDir::rootPath().append("../..")) << QDir::rootPath();
+ QTest::newRow("drive:") << QDir::rootPath().left(2) << QDir::currentPath();
+#endif
}
void tst_QDir::canonicalPath()
@@ -1546,6 +1561,32 @@ void tst_QDir::updateFileLists()
QCOMPARE(dir.entryList(), QStringList() << "sub-dir1" << "sub-dir2" << "file1.txt");
}
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+void tst_QDir::isRoot_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("isRoot");
+
+ QString test = QDir::rootPath();
+ QTest::newRow("rootPath " + test) << test << true;
+ test = QDir::rootPath().append("./");
+ QTest::newRow("./ appended " + test) << test << false;
+ test = QDir(QDir::rootPath().append("./")).canonicalPath();
+ QTest::newRow("canonicalPath " + test) << test << true;
+ test = QDir::rootPath().left(2);
+ QTest::newRow("drive relative " + test) << test << false;
+}
+
+void tst_QDir::isRoot()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, isRoot);
+
+ QDir dir(path);
+ QCOMPARE(dir.isRoot(),isRoot);
+}
+#endif
+
QTEST_MAIN(tst_QDir)
#include "tst_qdir.moc"