diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-06-29 18:13:24 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:31 -0300 |
commit | da39716cc95ca03f20c32928709b092a1989ce26 (patch) | |
tree | c3b60b20fbcf79837b9455c8f6cf5b703768689d /tests/QtWebKit | |
parent | b6f38556bd8cfcc61c537701a61cde56b4f704cf (diff) |
Fixes bug #899 - http://bugs.pyside.org/show_bug.cgi?id=899
Added unit test.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araujo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/QtWebKit')
-rw-r--r-- | tests/QtWebKit/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtWebKit/qvariantlist_property_test.py | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/QtWebKit/CMakeLists.txt b/tests/QtWebKit/CMakeLists.txt index bfe5c0ea0..5e1344018 100644 --- a/tests/QtWebKit/CMakeLists.txt +++ b/tests/QtWebKit/CMakeLists.txt @@ -1,6 +1,7 @@ PYSIDE_TEST(bug_448.py) PYSIDE_TEST(bug_694.py) PYSIDE_TEST(bug_803.py) +PYSIDE_TEST(qvariantlist_property_test.py) PYSIDE_TEST(webpage_test.py) PYSIDE_TEST(webview_test.py) PYSIDE_TEST(webframe_test.py) diff --git a/tests/QtWebKit/qvariantlist_property_test.py b/tests/QtWebKit/qvariantlist_property_test.py new file mode 100644 index 000000000..33ffc1d2d --- /dev/null +++ b/tests/QtWebKit/qvariantlist_property_test.py @@ -0,0 +1,43 @@ +import unittest +from PySide.QtCore import Property, QObject +from PySide.QtWebKit import QWebView +from helper import TimedQApplication + +class TestLoadFinished(TimedQApplication): + + def setUp(self): + TimedQApplication.setUp(self, timeout=1000) + + def tearDown(self): + TimedQApplication.tearDown(self) + + def testQVariantListProperty(self): + class Obj(object): + list = ['foo', 'bar', 'baz'] + + obj = Obj() + + wrapper_dict = {} + for name in ['list']: + getter = lambda arg=None, name=name: getattr(obj, name) + wrapper_dict[name] = Property('QVariantList', getter) + wrapper = type('PyObj', (QObject,), wrapper_dict) + + view = QWebView() + frame = view.page().mainFrame() + frame.addToJavaScriptWindowObject('py_obj', wrapper()) + + html = ''' + <html><body> + <script type="text/javascript"> + document.write(py_obj.list) + </script> + </body></html> + ''' + view.setHtml(html) + view.show() + self.app.exec_() + + +if __name__ == '__main__': + unittest.main() |