diff options
author | Liang Qi <liang.qi@qt.io> | 2017-10-30 08:43:14 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-30 08:54:05 +0100 |
commit | 17d51411132edef53e79dcbaf1046f06f79bed5d (patch) | |
tree | 38398d448b30313f91960c70a3a28cce91293da9 /tests/auto/corelib/io/qurl | |
parent | ea0e868c4881944207e9b3a77011e05a505ff3b7 (diff) | |
parent | 9f0dda29d5d070f63b7f098139f01f07ec91ffdf (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/plugins/platforms/windows/qwindowswindow.cpp
tests/auto/widgets/kernel/qaction/tst_qaction.cpp
Change-Id: Ia017a825ed2ca2d53ac586f4ae48df6f65818d40
Diffstat (limited to 'tests/auto/corelib/io/qurl')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 400a89c03f..20282068cb 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -2063,6 +2063,11 @@ void tst_QUrl::isValid() QVERIFY(!url.isValid()); QVERIFY(url.toString().isEmpty()); QVERIFY(url.errorString().contains("Path component starts with '//' and authority is absent")); + + // should disappear if we set a port + url.setPort(80); + QVERIFY(url.isValid()); + QCOMPARE(url.toString(), QString("http://:80//example.com")); } { @@ -2071,6 +2076,13 @@ void tst_QUrl::isValid() QVERIFY(!url.isValid()); QVERIFY(url.toString().isEmpty()); QVERIFY(url.errorString().contains("':' before any '/'")); + + // this specific error disappears if we set anything in the authority, + // but then we run into another error + url.setPort(80); + QVERIFY(!url.isValid()); + QVERIFY(url.toString().isEmpty()); + QVERIFY(url.errorString().contains("Path component is relative and authority is present")); } { @@ -2810,6 +2822,29 @@ void tst_QUrl::setPort() QCOMPARE(url.port(), -1); QVERIFY(url.errorString().contains("out of range")); } + + { + QUrl reference("//:80"); + QUrl piecewise; + piecewise.setPort(80); + QCOMPARE(piecewise, reference); + } + + { + // setAuthority must clear the port + QUrl url("http://example.com:80"); + url.setAuthority("example.org"); + QCOMPARE(url.port(), -1); + QCOMPARE(url.toString(), QString("http://example.org")); + } + + { + // setAuthority must clear the port + QUrl url("http://example.com:80"); + url.setAuthority(QString()); + QCOMPARE(url.port(), -1); + QCOMPARE(url.toString(), QString("http:")); + } } void tst_QUrl::port_data() |