Add unit test to ensure %3A in a path isn't decoded to ':'

QUrl("http%3A%2F%2Fexample.com") has only a path of
"http%3A%2F%2Fexample.com". In Qt 5.0 and 5.1, the %3A would get decoded
to ':', which in turn makes the URL invalid (colon before first slash).

Found via discussion on the interest mailing list.

Change-Id: I7f4f242b330df280e635eb97cce123e742aa1b10
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2013-08-13 15:58:40 -07:00 committed by The Qt Project
parent 043b809197
commit 7c2a418857

View File

@ -3368,6 +3368,11 @@ void tst_QUrl::setComponents_data()
QTest::newRow("path-empty") << QUrl("http://example.com/path")
<< int(Path) << "" << Tolerant << true
<< PrettyDecoded << "" << "http://example.com";
// If the %3A gets decoded to ":", the URL becomes invalid;
// see test path-invalid-1 below
QTest::newRow("path-%3A-before-slash") << QUrl()
<< int(Path) << "c%3A/" << Tolerant << true
<< PrettyDecoded << "c%3A/" << "c%3A/";
// the other fields can be present and be empty
// that is, their delimiters would be present, but there would be nothing to one side