summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2019-05-29 18:02:19 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-06-03 12:29:49 +0000
commit8c7589d992a5615fa3a98f67d098d5a2fca579cb (patch)
tree7953de8458635b59fcd725a15432be95fd2e16d8 /tests
parent6f40331058071e628e83e74c7f2032e41b1a3f3d (diff)
Do not strip off the fragment and query in the qfileselector
This is needed for cases where we use e.g. "file:///test.html?query#Fragment". The fragment and query were already preserved for the qrc scheme. This fixes it for the file scheme. Change-Id: I5713e4a25372fdd55ac255b1c6228b4dea419244 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index c9f1e3d9f6..11b1fdaeeb 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -205,15 +205,23 @@ void tst_QFileSelector::urlConvenience_data()
QString test("/test");// '/' is here so dir string can also be selector string
QString custom1("custom1");
+ QString testWithQueryAndFragment("/test?query#Fragment");
QTest::newRow("qrc") << QUrl("qrc:///extras/test") << (QStringList() << custom1)
<< QUrl(QString("qrc:///extras/") + QLatin1Char(selectorIndicator) + custom1 + test);
+ QTest::newRow("qrc with query and fragment") << QUrl(QString::fromLatin1("qrc:///extras%1").arg(testWithQueryAndFragment)) << (QStringList() << custom1)
+ << QUrl(QString("qrc:///extras/") + QLatin1Char(selectorIndicator) + custom1 + testWithQueryAndFragment);
QString fileBasePath = QFINDTESTDATA("extras/test");
QString fileSelectedPath = QFINDTESTDATA(QString("extras/") + QLatin1Char(selectorIndicator)
+ custom1 + QString("/test"));
QTest::newRow("file") << QUrl::fromLocalFile(fileBasePath) << (QStringList() << custom1)
<< QUrl::fromLocalFile(fileSelectedPath);
+ // do not strip off the query and fragment
+ QString strUrlWithFragment = QString("file://") + testWithQueryAndFragment;
+ QTest::newRow("file with query and fragment") << QUrl(strUrlWithFragment) << (QStringList()) << QUrl(strUrlWithFragment);
+ strUrlWithFragment = QString("file:") + testWithQueryAndFragment;
+ QTest::newRow("file with query and fragment too") << QUrl(strUrlWithFragment) << (QStringList()) << QUrl(strUrlWithFragment);
// http://qt-project.org/images/qtdn/sprites-combined-latest.png is chosen as a representative real world URL
// But note that this test is checking that http urls are NOT selected so it shouldn't be checked