summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdir
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-09-01 14:04:33 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-09-02 12:38:57 (GMT)
commitddf5a09d469a1ded5490cffe54e0013a0d5ba347 (patch)
tree656e7a7abaacd551f554bf2326dba20276eb194d /tests/auto/qdir
parentca34cc75294e0d2a8bc491a2c679fe8a69cd0408 (diff)
downloadQt-ddf5a09d469a1ded5490cffe54e0013a0d5ba347.zip
Qt-ddf5a09d469a1ded5490cffe54e0013a0d5ba347.tar.gz
Qt-ddf5a09d469a1ded5490cffe54e0013a0d5ba347.tar.bz2
Fix comparison of absolute, unclean paths in QDir
QDir::operator== was creating a clean absolute path for comparison purposes if the original path was relative. However original absolute paths were trusted, even though they could be unclean. Now they are checked for cleanliness first. Task-Number: QTBUG-19995 Task-Number: QTBUG-20495 Change-Id: I047a1a40ae5151e4604085e4ac87f30a4e4979c4 Reviewed-on: http://codereview.qt.nokia.com/4099 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
Diffstat (limited to 'tests/auto/qdir')
-rw-r--r--tests/auto/qdir/tst_qdir.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 419eaae..7e5ec79 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -1133,6 +1133,11 @@ void tst_QDir::absolutePath_data()
QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1";
QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1";
#endif
+ //test dirty paths are cleaned (QTBUG-19995)
+ QTest::newRow("/home/qt/.") << QDir::rootPath() + "home/qt/." << QDir::rootPath() + "home/qt";
+ QTest::newRow("/system/data/../config") << QDir::rootPath() + "system/data/../config" << QDir::rootPath() + "system/config";
+ QTest::newRow("//home//qt/") << QDir::rootPath() + "/home//qt/" << QDir::rootPath() + "home/qt";
+ QTest::newRow("foo/../bar") << "foo/../bar" << QDir::currentPath() + "/bar";
QTest::newRow("resource") << ":/prefix/foo.bar" << ":/prefix/foo.bar";
}
@@ -1942,6 +1947,14 @@ void tst_QDir::equalityOperator_data()
<< "./entrylist" << "*.cpp" << int(QDir::Name) << int(QDir::Files)
<< true;
+ QTest::newRow("QTBUG-20495") << QDir::currentPath() + "/entrylist/.." << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+ << "." << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+ << true;
+
+ QTest::newRow("QTBUG-20495-root") << QDir::rootPath() + "tmp/.." << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+ << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+ << true;
+
QTest::newRow("diff-filters") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
<< SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Dirs)
<< false;