summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qdir/tst_qdir.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-04 16:02:06 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-24 15:43:58 +0000
commitec8c1dcf147ac71ea3c0105d67c2575ab733d348 (patch)
treec7e9f264ee899779d154e3bb0afc3871f61c60d4 /tests/auto/corelib/io/qdir/tst_qdir.cpp
parent0e41a58fb8f15a9a0790db2f33efe32d3c227bc2 (diff)
Make QDir::relativeFilePath() return "." for a path to itself.
The rationale being that the empty string is not a valid path component. [ChangeLog][QtCore][QDir] QDir::relativeFilePath() now returns "." instead of an empty string if the given path is the same as the directory. Change-Id: Ibcf31904b2ae5edf5639d4c2e5ba234365d347fd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/io/qdir/tst_qdir.cpp')
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index e8a7105f6e..45289df398 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1366,6 +1366,9 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("11") << "" << "" << "";
+ QTest::newRow("same path 1") << "/tmp" << "/tmp" << ".";
+ QTest::newRow("same path 2") << "//tmp" << "/tmp/" << ".";
+
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding";
QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong";
@@ -1373,10 +1376,10 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("15") << "C:/foo/bar" << "D:/ding/dong" << "D:/ding/dong";
QTest::newRow("16") << "C:" << "C:/ding/dong" << "ding/dong";
QTest::newRow("17") << "C:/" << "C:/ding/dong" << "ding/dong";
- QTest::newRow("18") << "C:" << "C:" << "";
- QTest::newRow("19") << "C:/" << "C:" << "";
- QTest::newRow("20") << "C:" << "C:/" << "";
- QTest::newRow("21") << "C:/" << "C:/" << "";
+ QTest::newRow("18") << "C:" << "C:" << ".";
+ QTest::newRow("19") << "C:/" << "C:" << ".";
+ QTest::newRow("20") << "C:" << "C:/" << ".";
+ QTest::newRow("21") << "C:/" << "C:/" << ".";
QTest::newRow("22") << "C:" << "C:file.txt" << "file.txt";
QTest::newRow("23") << "C:/" << "C:file.txt" << "file.txt";
QTest::newRow("24") << "C:" << "C:/file.txt" << "file.txt";