summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-09-16 20:41:17 -0700
committerThiago Macieira <thiago.macieira@intel.com>2020-10-08 03:54:10 +0000
commit197e61711702ba1517e9e7e4219ca2801639197c (patch)
tree93e281cf27403896fe87489ef0a91bf3008950a1
parenta9d6b72fccefb02624943b08554f80f56e934a31 (diff)
tst_QUrl/Win: test QUrl::fromLocalFile with backslashes
Change-Id: I3eb349b832c14610895efffd1635752ccc82889a Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit dfa35ee6c8c919ccf1ae378074cf1b5501c24d9e)
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index fddd7eb266..d506ae5a66 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1316,12 +1316,23 @@ void tst_QUrl::fromLocalFile_data()
QTest::newRow("windows-drive") << QString::fromLatin1("c:/a.txt") << QString::fromLatin1("file:///c:/a.txt") << QString::fromLatin1("/c:/a.txt");
// Windows UNC paths
- QTest::addRow("windows-unc-path") << QString::fromLatin1("//somehost/somedir/somefile") << QString::fromLatin1("file://somehost/somedir/somefile")
- << QString::fromLatin1("/somedir/somefile");
- QTest::newRow("windows-unc-nopath") << QString::fromLatin1("//somehost") << QString::fromLatin1("file://somehost")
- << QString::fromLatin1("");
- QTest::newRow("windows-unc-root") << QString::fromLatin1("//somehost/") << QString::fromLatin1("file://somehost/")
- << QString::fromLatin1("/");
+ for (const char *suffix : { "", "/", "/somedir/somefile" }) {
+ const char *pathDescription =
+ strlen(suffix) == 0 ? "nopath" :
+ strlen(suffix) > 1 ? "path" : "root";
+
+ QTest::addRow("windows-unc-%s", pathDescription)
+ << QString("//somehost") + suffix
+ << QString("file://somehost") + suffix
+ << QString(suffix);
+#ifdef Q_OS_WIN32
+ // debackslashification only happens on Windows
+ QTest::addRow("windows-backslash-unc-%s", pathDescription)
+ << QString(QString("//somehost") + suffix).replace('/', '\\')
+ << QString("file://somehost") + suffix
+ << QString(suffix);
+#endif
+ }
QTest::newRow("windows-webdav")
<< QString::fromLatin1("//somewebdavhost@SSL/somedir/somefile")