summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qurlinternal
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-07-02 13:29:13 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-20 05:06:34 +0200
commit3d77406e27230089e5a847b03c93d66117343d75 (patch)
treeacc93994d8eaf6122fe16b53ec4fa88304011135 /tests/auto/corelib/io/qurlinternal
parentb60cac3602b54dbd3a4b717d143f620da10c1f32 (diff)
Make the URL Recode function to fix bad input in FullyDecoded mode too
So far, this function hasn't been used for input coming in from the user, so it wasn't necessary. But we may want to do it, or we may already be doing it accidentally somewhere that isn't triggering the failed assertions during unit testing. So let's be on the safe side and allow it. And test it too. Change-Id: Ib63addd8da468ad6908278d07a4829f1bdc26a07 Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'tests/auto/corelib/io/qurlinternal')
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 2014045171..b39b34e494 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -824,12 +824,20 @@ void tst_QUrlInternal::correctEncodedMistakes()
QFETCH(QString, expected);
// prepend some data to be sure that it remains there
- QString output = QTest::currentDataTag();
- expected.prepend(output);
+ QString dataTag = QTest::currentDataTag();
+ QString output = dataTag;
if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), 0))
output += input;
- QCOMPARE(output, expected);
+ QCOMPARE(output, dataTag + expected);
+
+ // now try the full decode mode
+ output = dataTag;
+ QString expected2 = QUrl::fromPercentEncoding(expected.toLatin1());
+
+ if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), QUrl::FullyDecoded))
+ output += input;
+ QCOMPARE(output, dataTag + expected2);
}
static void addUtf8Data(const char *name, const char *data)