From 2591545ee1ffa29236900d4cc08724c9f0dd7107 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 19 Oct 2011 20:31:46 +0200 Subject: QUrl: Always lowercase the scheme Change-Id: I8d467014d22384f1be15fdd746e20b1153a82a4e Reviewed-by: Lars Knoll --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 1c34d8a114..680cc3b137 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -155,6 +155,7 @@ private slots: void toEncodedNotUsingUninitializedPath(); void emptyAuthorityRemovesExistingAuthority(); void acceptEmptyAuthoritySegments(); + void lowercasesScheme(); }; // Testing get/set functions @@ -320,9 +321,9 @@ void tst_QUrl::setUrl() } { - QUrl url("hTTp://www.foo.bar:80"); + QUrl url("http://www.foo.bar:80"); QVERIFY(url.isValid()); - QCOMPARE(url.scheme(), QString::fromLatin1("hTTp")); + QCOMPARE(url.scheme(), QString::fromLatin1("http")); QCOMPARE(url.path(), QString()); QVERIFY(url.encodedQuery().isEmpty()); QVERIFY(url.userInfo().isEmpty()); @@ -330,12 +331,12 @@ void tst_QUrl::setUrl() QCOMPARE(url.host(), QString::fromLatin1("www.foo.bar")); QCOMPARE(url.authority(), QString::fromLatin1("www.foo.bar:80")); QCOMPARE(url.port(), 80); - QCOMPARE(url.toString(), QString::fromLatin1("hTTp://www.foo.bar:80")); - QCOMPARE(url.toDisplayString(), QString::fromLatin1("hTTp://www.foo.bar:80")); - QCOMPARE(url.toDisplayString(QUrl::PreferLocalFile), QString::fromLatin1("hTTp://www.foo.bar:80")); + QCOMPARE(url.toString(), QString::fromLatin1("http://www.foo.bar:80")); + QCOMPARE(url.toDisplayString(), QString::fromLatin1("http://www.foo.bar:80")); + QCOMPARE(url.toDisplayString(QUrl::PreferLocalFile), QString::fromLatin1("http://www.foo.bar:80")); QUrl url2("//www1.foo.bar"); - QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("hTTp://www1.foo.bar")); + QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("http://www1.foo.bar")); } { @@ -2481,5 +2482,12 @@ void tst_QUrl::effectiveTLDs() QCOMPARE(domain.topLevelDomain(), TLD); } +void tst_QUrl::lowercasesScheme() +{ + QUrl url; + url.setScheme("HELLO"); + QCOMPARE(url.scheme(), QString("hello")); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" -- cgit v1.2.3