Created unit test for bug #973.
Reviewed by: Hugo Parente <hugo.lima@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
b3e839c1f8
commit
01bd258e10
2 changed files with 29 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ PYSIDE_TEST(bug_899.py)
|
||||||
PYSIDE_TEST(bug_959.py)
|
PYSIDE_TEST(bug_959.py)
|
||||||
PYSIDE_TEST(qvariantlist_property_test.py)
|
PYSIDE_TEST(qvariantlist_property_test.py)
|
||||||
PYSIDE_TEST(qml_plugin_test.py)
|
PYSIDE_TEST(qml_plugin_test.py)
|
||||||
|
PYSIDE_TEST(shouldInterruptjavascript_test.py)
|
||||||
PYSIDE_TEST(webpage_test.py)
|
PYSIDE_TEST(webpage_test.py)
|
||||||
PYSIDE_TEST(webview_test.py)
|
PYSIDE_TEST(webview_test.py)
|
||||||
PYSIDE_TEST(webframe_test.py)
|
PYSIDE_TEST(webframe_test.py)
|
||||||
|
|
|
||||||
28
tests/QtWebKit/shouldInterruptjavascript_test.py
Normal file
28
tests/QtWebKit/shouldInterruptjavascript_test.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
from PySide import QtCore, QtWebKit
|
||||||
|
|
||||||
|
from helper import UsesQApplication
|
||||||
|
|
||||||
|
class QWebPageHeadless(QtWebKit.QWebPage):
|
||||||
|
# FIXME: This is not working, the slot is not overriden!
|
||||||
|
# http://doc.qt.nokia.com/4.7-snapshot/qwebpage.html#shouldInterruptJavaScript
|
||||||
|
@QtCore.Slot()
|
||||||
|
def shouldInterruptJavaScript(self):
|
||||||
|
self._interrupted = True
|
||||||
|
QtCore.QTimer.singleShot(300, self._app.quit)
|
||||||
|
return True
|
||||||
|
|
||||||
|
class TestSlotOverride(UsesQApplication):
|
||||||
|
def testFunctionCall(self):
|
||||||
|
page = QWebPageHeadless()
|
||||||
|
page._interrupted = False
|
||||||
|
page._app = self.app
|
||||||
|
page.mainFrame().setHtml('<script>while(1);</script>')
|
||||||
|
self.app.exec_()
|
||||||
|
self.assertTrue(page._interrupted)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue