tst_qurl: Make an invalid URL test compatible with UTS #46

Use U+1F100 DIGIT ZERO FULL STOP instead of U+1F4D9 ORANGE BOOK.
The latter is not allowed according to IDNA 2003 rules but is allowed
according to UTS #46 rules. The former is disallowed in either case.

Task-number: QTBUG-85371
Change-Id: Idc8afef68c26ae0b702a475e5a53592182998a08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2021-08-17 16:10:30 +02:00
parent bac329a28b
commit 5b01399781

View File

@ -2145,14 +2145,15 @@ void tst_QUrl::isValid()
} }
{ {
QUrl url = QUrl::fromEncoded("foo://%f0%9f%93%99.example.la/g"); // U+1F100 DIGIT ZERO FULL STOP
QUrl url = QUrl::fromEncoded("foo://%f0%9f%84%80.example.la/g");
QVERIFY(!url.isValid()); QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty()); QVERIFY(url.toString().isEmpty());
QCOMPARE(url.path(), QString("/g")); QCOMPARE(url.path(), QString("/g"));
url.setHost("%f0%9f%93%99.example.la/"); url.setHost("%f0%9f%84%80.example.la/");
QVERIFY(!url.isValid()); QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty()); QVERIFY(url.toString().isEmpty());
url.setHost("\xf0\x9f\x93\x99.example.la/"); url.setHost("\xf0\x9f\x84\x80.example.la/");
QVERIFY(!url.isValid()); QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty()); QVERIFY(url.toString().isEmpty());
QVERIFY2(url.errorString().contains("Invalid hostname"), QVERIFY2(url.errorString().contains("Invalid hostname"),