tests: Check args for loadFinished signals.

This commit is contained in:
Florian Bruhin 2015-12-17 07:43:57 +01:00
parent c1951a8f15
commit e78d2a8399
2 changed files with 5 additions and 2 deletions

View File

@ -628,8 +628,9 @@ class TestJavascriptEscape:
with open(path, encoding='utf-8') as f:
html_source = f.read().replace('%INPUT%', escaped)
with qtbot.waitSignal(webframe.loadFinished, raising=True):
with qtbot.waitSignal(webframe.loadFinished, raising=True) as blocker:
webframe.setHtml(html_source)
assert blocker.args == [True]
result = webframe.evaluateJavaScript('window.qute_test_result')
assert result is not None

View File

@ -94,8 +94,10 @@ class JSTester:
**kwargs: Passed to jinja's template.render().
"""
template = self._jinja_env.get_template(path)
with self._qtbot.waitSignal(self.webview.loadFinished, raising=True):
with self._qtbot.waitSignal(self.webview.loadFinished,
raising=True) as blocker:
self.webview.setHtml(template.render(**kwargs))
assert blocker.args == [True]
def run_file(self, filename):
"""Run a javascript file.