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:
|
if url is None:
|
||||||
self._normal_url = None
|
self._normal_url = None
|
||||||
|
elif not url.isValid():
|
||||||
|
self._normal_url = "Invalid URL!"
|
||||||
else:
|
else:
|
||||||
self._normal_url = urlutils.safe_display_url(url)
|
self._normal_url = urlutils.safe_display_url(url)
|
||||||
self._normal_url_type = UrlType.normal
|
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."""
|
"""Test text when hovering over a percent encoded link."""
|
||||||
qurl = QUrl(url_text)
|
qurl = QUrl(url_text)
|
||||||
if which == 'normal':
|
if which == 'normal':
|
||||||
if not qurl.isValid():
|
if url_text is None:
|
||||||
with pytest.raises(urlutils.InvalidUrlError):
|
|
||||||
url_widget.set_url(qurl)
|
|
||||||
return
|
return
|
||||||
else:
|
if not qurl.isValid():
|
||||||
url_widget.set_url(qurl)
|
# Special case for the invalid URL above
|
||||||
|
expected = "Invalid URL!"
|
||||||
|
url_widget.set_url(qurl)
|
||||||
else:
|
else:
|
||||||
url_widget.set_hover_url(url_text)
|
url_widget.set_hover_url(url_text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user