summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-04-29 19:51:13 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-08-23 18:31:41 +0200
commit7bc01145cc3c7b851195e8c4fbbd118b685eb1fd (patch)
tree7b938061e0be54b95b9972b0aa0bfda9019325dc
parent4a799c15e7c52d45ebd2b407b4210310846e6aac (diff)
downloadqutebrowser-7bc01145cc3c7b851195e8c4fbbd118b685eb1fd.tar.gz
qutebrowser-7bc01145cc3c7b851195e8c4fbbd118b685eb1fd.zip
tests: Update QUrl tests for Qt 6.3
See https://bugreports.qt.io/browse/QTBUG-85371 and https://bugreports.qt.io/browse/QTBUG-60364
-rw-r--r--tests/unit/mainwindow/statusbar/test_url.py25
-rw-r--r--tests/unit/utils/test_urlutils.py26
2 files changed, 46 insertions, 5 deletions
diff --git a/tests/unit/mainwindow/statusbar/test_url.py b/tests/unit/mainwindow/statusbar/test_url.py
index ff84c67e2..353c47a3c 100644
--- a/tests/unit/mainwindow/statusbar/test_url.py
+++ b/tests/unit/mainwindow/statusbar/test_url.py
@@ -24,7 +24,7 @@ import pytest
from qutebrowser.qt.core import QUrl
-from qutebrowser.utils import usertypes, urlutils
+from qutebrowser.utils import usertypes, urlutils, qtutils
from qutebrowser.mainwindow.statusbar import url
@@ -37,6 +37,18 @@ def url_widget(qtbot, monkeypatch, config_stub):
return widget
+qurl_idna2003 = pytest.mark.skipif(
+ qtutils.version_check("6.3.0", compiled=False),
+ reason="Different result with Qt >= 6.3.0: "
+ "https://bugreports.qt.io/browse/QTBUG-85371"
+)
+qurl_uts46 = pytest.mark.xfail(
+ not qtutils.version_check("6.3.0", compiled=False),
+ reason="Different result with Qt < 6.3.0: "
+ "https://bugreports.qt.io/browse/QTBUG-85371"
+)
+
+
@pytest.mark.parametrize('url_text, expected', [
('http://example.com/foo/bar.html', 'http://example.com/foo/bar.html'),
('http://test.gr/%CE%B1%CE%B2%CE%B3%CE%B4.txt', 'http://test.gr/αβγδ.txt'),
@@ -46,7 +58,16 @@ def url_widget(qtbot, monkeypatch, config_stub):
('http://username:secret%20password@test.com', 'http://username@test.com'),
('http://example.com%5b/', '(invalid URL!) http://example.com%5b/'),
# https://bugreports.qt.io/browse/QTBUG-60364
- ('http://www.xn--80ak6aa92e.com', 'http://www.xn--80ak6aa92e.com'),
+ pytest.param(
+ 'http://www.xn--80ak6aa92e.com',
+ 'http://www.xn--80ak6aa92e.com',
+ marks=qurl_idna2003
+ ),
+ pytest.param(
+ 'http://www.xn--80ak6aa92e.com',
+ '(www.xn--80ak6aa92e.com) http://www.аррӏе.com',
+ marks=qurl_uts46,
+ ),
# IDN URL
('http://www.ä.com', '(www.xn--4ca.com) http://www.ä.com'),
(None, ''),
diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py
index 6ba0871cc..a94ecef6a 100644
--- a/tests/unit/utils/test_urlutils.py
+++ b/tests/unit/utils/test_urlutils.py
@@ -32,7 +32,7 @@ import hypothesis.strategies
from qutebrowser.api import cmdutils
from qutebrowser.browser.network import pac
-from qutebrowser.utils import utils, urlutils, usertypes
+from qutebrowser.utils import utils, urlutils, usertypes, qtutils
class FakeDNS:
@@ -675,6 +675,18 @@ def test_data_url():
assert url == QUrl('data:text/plain;base64,Zm9v')
+qurl_idna2003 = pytest.mark.skipif(
+ qtutils.version_check("6.3.0", compiled=False),
+ reason="Different result with Qt >= 6.3.0: "
+ "https://bugreports.qt.io/browse/QTBUG-85371"
+)
+qurl_uts46 = pytest.mark.xfail(
+ not qtutils.version_check("6.3.0", compiled=False),
+ reason="Different result with Qt < 6.3.0: "
+ "https://bugreports.qt.io/browse/QTBUG-85371"
+)
+
+
@pytest.mark.parametrize('url, expected', [
# No IDN
(QUrl('http://www.example.com'), 'http://www.example.com'),
@@ -688,8 +700,16 @@ def test_data_url():
(QUrl('http://www.example.xn--p1ai'),
'(www.example.xn--p1ai) http://www.example.рф'),
# https://bugreports.qt.io/browse/QTBUG-60364
- (QUrl('http://www.xn--80ak6aa92e.com'),
- 'http://www.xn--80ak6aa92e.com'),
+ pytest.param(
+ QUrl('http://www.xn--80ak6aa92e.com'),
+ 'http://www.xn--80ak6aa92e.com',
+ marks=qurl_idna2003,
+ ),
+ pytest.param(
+ QUrl('http://www.xn--80ak6aa92e.com'),
+ '(www.xn--80ak6aa92e.com) http://www.аррӏе.com',
+ marks=qurl_uts46,
+ ),
])
def test_safe_display_string(url, expected):
assert urlutils.safe_display_string(url) == expected