diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-11-11 13:56:41 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-11-12 13:20:14 (GMT) |
commit | aeea26b384a362e59c335f7932a8b3915c1c8383 (patch) | |
tree | d895f0477a5dcc255083d4e4505640ddd4104ed3 /tests/auto | |
parent | d39104d9b0ce43f872d2880baef8e1cff289adb8 (diff) | |
download | Qt-aeea26b384a362e59c335f7932a8b3915c1c8383.zip Qt-aeea26b384a362e59c335f7932a8b3915c1c8383.tar.gz Qt-aeea26b384a362e59c335f7932a8b3915c1c8383.tar.bz2 |
QUrl::fromUserInput: improvements, corrections and make the demo
browser use it.
- Handle windows files names by looking for paths first (and don't check
that it exists first)
- Handle host names without dots (it was not handled because of
difficulties with the case host:port)
- Return the parsed url only if the host or the path is not empty
instead of returning a url that looks like "http:"
Reviewed-by: Thiago Macieira
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qurl/tst_qurl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index c8fe4e5..03e77aa 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -3713,7 +3713,7 @@ void tst_QUrl::fromUserInput_data() QTest::newRow("add scheme-0") << "example.org" << QUrl("http://example.org"); QTest::newRow("add scheme-1") << "www.example.org" << QUrl("http://www.example.org"); QTest::newRow("add scheme-2") << "ftp.example.org" << QUrl("ftp://ftp.example.org"); - QTest::newRow("add scheme-3") << "webkit" << QUrl("webkit"); + QTest::newRow("add scheme-3") << "hostname" << QUrl("http://hostname"); // QUrl's tolerant parser should already handle this QTest::newRow("not-encoded-0") << "http://example.org/test page.html" << QUrl::fromEncoded("http://example.org/test%20page.html"); @@ -3723,6 +3723,9 @@ void tst_QUrl::fromUserInput_data() portUrl.setPort(80); QTest::newRow("port-0") << "example.org:80" << portUrl; QTest::newRow("port-1") << "http://example.org:80" << portUrl; + portUrl.setPath("path"); + QTest::newRow("port-1") << "example.org:80/path" << portUrl; + QTest::newRow("port-1") << "http://example.org:80/path" << portUrl; // mailto doesn't have a ://, but is valid QUrl mailto("ben@example.net"); @@ -3730,10 +3733,11 @@ void tst_QUrl::fromUserInput_data() QTest::newRow("mailto") << "mailto:ben@example.net" << mailto; // misc - QTest::newRow("localhost-0") << "localhost" << QUrl("http://localhost"); QTest::newRow("localhost-1") << "localhost:80" << QUrl("http://localhost:80"); QTest::newRow("spaces-0") << " http://example.org/test page.html " << QUrl("http://example.org/test%20page.html"); QTest::newRow("trash-0") << "example.org/test?someData=42%&someOtherData=abcde#anchor" << QUrl::fromEncoded("http://example.org/test?someData=42%25&someOtherData=abcde#anchor"); + QTest::newRow("other-scheme-0") << "spotify:track:0hO542doVbfGDAGQULMORT" << QUrl("spotify:track:0hO542doVbfGDAGQULMORT"); + QTest::newRow("other-scheme-1") << "weirdscheme:80:otherstuff" << QUrl("weirdscheme:80:otherstuff"); // FYI: The scheme in the resulting url user QUrl authUrl("user:pass@domain.com"); |