Add test for styling error pages
This commit is contained in:
parent
04b66e1a0a
commit
2f9a857a27
@ -195,16 +195,17 @@ class JSWebEngineTester:
|
||||
self.webview.setHtml(template.render(**kwargs))
|
||||
assert blocker.args == [True]
|
||||
|
||||
def load_file(self, path: str):
|
||||
def load_file(self, path: str, force=False):
|
||||
"""Loads a file from disk"""
|
||||
self.load_url(QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__), path)))
|
||||
os.path.join(os.path.dirname(__file__), path)), force)
|
||||
|
||||
def load_url(self, url: QUrl):
|
||||
def load_url(self, url: QUrl, force=False):
|
||||
"""Load a given QUrl."""
|
||||
with self._qtbot.waitSignal(self.webview.loadFinished) as blocker:
|
||||
self.webview.load(url)
|
||||
assert blocker.args == [True]
|
||||
if not force:
|
||||
assert blocker.args == [True]
|
||||
import time
|
||||
time.sleep(1)
|
||||
|
||||
|
@ -111,3 +111,9 @@ def test_no_set_svg(stylesheet_tester):
|
||||
stylesheet_tester.check_set(None)
|
||||
stylesheet_tester.set_css("body {background-color: rgb(0, 255, 0);}")
|
||||
stylesheet_tester.check_set(None)
|
||||
|
||||
def test_set_error(stylesheet_tester):
|
||||
"""Test stylesheet modifies file not found error pages."""
|
||||
stylesheet_tester.init_stylesheet()
|
||||
stylesheet_tester.js.load_file('non-existent.html', force=True)
|
||||
stylesheet_tester.check_set(GREEN_BODY_BG)
|
||||
|
Loading…
Reference in New Issue
Block a user