diff options
-rw-r--r-- | tests/unit/mainwindow/statusbar/test_url.py | 25 | ||||
-rw-r--r-- | tests/unit/utils/test_urlutils.py | 26 |
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 |