Fix invalid URL handling in statusbar
This commit is contained in:
parent
38294c1ca6
commit
b632fe3285
@ -138,6 +138,8 @@ class UrlText(textbase.TextBase):
|
||||
"""
|
||||
if url is None:
|
||||
self._normal_url = None
|
||||
elif not url.isValid():
|
||||
self._normal_url = "Invalid URL!"
|
||||
else:
|
||||
self._normal_url = urlutils.safe_display_url(url)
|
||||
self._normal_url_type = UrlType.normal
|
||||
|
@ -71,12 +71,12 @@ def test_set_url(url_widget, url_text, expected, which):
|
||||
"""Test text when hovering over a percent encoded link."""
|
||||
qurl = QUrl(url_text)
|
||||
if which == 'normal':
|
||||
if not qurl.isValid():
|
||||
with pytest.raises(urlutils.InvalidUrlError):
|
||||
url_widget.set_url(qurl)
|
||||
if url_text is None:
|
||||
return
|
||||
else:
|
||||
url_widget.set_url(qurl)
|
||||
if not qurl.isValid():
|
||||
# Special case for the invalid URL above
|
||||
expected = "Invalid URL!"
|
||||
url_widget.set_url(qurl)
|
||||
else:
|
||||
url_widget.set_hover_url(url_text)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user