aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/QtWebKit/CMakeLists.txt1
-rw-r--r--tests/QtWebKit/shouldInterruptjavascript_test.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/QtWebKit/CMakeLists.txt b/tests/QtWebKit/CMakeLists.txt
index 5f0820d31..7fab64773 100644
--- a/tests/QtWebKit/CMakeLists.txt
+++ b/tests/QtWebKit/CMakeLists.txt
@@ -5,6 +5,7 @@ PYSIDE_TEST(bug_899.py)
PYSIDE_TEST(bug_959.py)
PYSIDE_TEST(qvariantlist_property_test.py)
PYSIDE_TEST(qml_plugin_test.py)
+PYSIDE_TEST(shouldInterruptjavascript_test.py)
PYSIDE_TEST(webpage_test.py)
PYSIDE_TEST(webview_test.py)
PYSIDE_TEST(webframe_test.py)
diff --git a/tests/QtWebKit/shouldInterruptjavascript_test.py b/tests/QtWebKit/shouldInterruptjavascript_test.py
new file mode 100644
index 000000000..b624220df
--- /dev/null
+++ b/tests/QtWebKit/shouldInterruptjavascript_test.py
@@ -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()