summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdir
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-08-11 15:49:37 +0200
committerJoão Abecasis <joao.abecasis@nokia.com>2011-08-26 14:06:42 +0200
commitdcee6e1371d899eb79717b8e3f3eec08b765db82 (patch)
treef34d4d7d6a05fb1939fbcb5d707496fdea095b38 /tests/auto/qdir
parent7b693627ee2a17718cb6d8bee5e3deb5a97b307f (diff)
Fix QDir::operator==(const QDir &) const
We can't rely on absolute paths when comparing directories for equality as these don't take into account symbolic links and may also bypass ../ and ./ simplification. Instead, canonical paths must be computed and can then be compared according to the case sensitivity rules for the platform or file engine, as is done in QFileInfo. Task-number: QTBUG-20495 Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'tests/auto/qdir')
-rw-r--r--tests/auto/qdir/tst_qdir.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 0a42a97f14..419eaae5ff 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -444,9 +444,15 @@ void tst_QDir::QDir_default()
void tst_QDir::compare()
{
// operator==
+
+ // Not using QCOMPARE to test result of QDir::operator==
+
QDir dir;
dir.makeAbsolute();
QVERIFY(dir == QDir::currentPath());
+
+ QVERIFY(QDir() == QDir(QDir::currentPath()));
+ QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/.."));
}
static QStringList filterLinks(const QStringList &list)