diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-08-26 16:03:08 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:48 -0300 |
commit | 01bd258e107ca3ef58e1b1dd9d9bc62f2b602c59 (patch) | |
tree | 66a0ac98c62139e2b037a45427244ce1fdbb0b92 /tests/QtWebKit | |
parent | b3e839c1f8cc0f2181ccafb4aebd9dd1a153eb8a (diff) |
Created unit test for bug #973.
Reviewed by: Hugo Parente <hugo.lima@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtWebKit')
-rw-r--r-- | tests/QtWebKit/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtWebKit/shouldInterruptjavascript_test.py | 28 |
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() |