aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtWebKit
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-07-11 18:56:57 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:35 -0300
commit794104582e2e8655d2e0f6564185a9ccc312fb62 (patch)
tree80c72ad37c04bf68ca21b41df4b9bff69db58bc3 /tests/QtWebKit
parentdc5ef0b998fefddf873304b54b13c34d874e0740 (diff)
Created unit test for bug #899.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'tests/QtWebKit')
-rw-r--r--tests/QtWebKit/CMakeLists.txt1
-rw-r--r--tests/QtWebKit/bug_899.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/QtWebKit/CMakeLists.txt b/tests/QtWebKit/CMakeLists.txt
index 5e1344018..b3a86ca5c 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(bug_899.py)
PYSIDE_TEST(qvariantlist_property_test.py)
PYSIDE_TEST(webpage_test.py)
PYSIDE_TEST(webview_test.py)
diff --git a/tests/QtWebKit/bug_899.py b/tests/QtWebKit/bug_899.py
new file mode 100644
index 000000000..f4daaab08
--- /dev/null
+++ b/tests/QtWebKit/bug_899.py
@@ -0,0 +1,36 @@
+import unittest
+from PySide.QtCore import Property, QObject
+from PySide.QtWebKit import QWebView
+from helper import TimedQApplication
+
+class TestLambdaPropery(TimedQApplication):
+
+ def testBug899(self):
+ html = '''
+ <html><body>
+ <script type="text/javascript">
+ document.write("<p>"+py_obj.list1+"</p>")
+ document.write("<p>"+py_obj.list2+"</p>")
+ </script>
+ </body></html>
+ '''
+
+ class Obj(object):
+ list1 = ['foo', 'bar', 'baz']
+ list2 = ['fi', 'fo', 'fum']
+
+ obj = Obj()
+
+ wrapper_dict = {}
+ for name in ('list1', 'list2'):
+ getter = lambda arg=None, name=name: getattr(obj, name)
+ wrapper_dict[name] = Property('QVariantList', getter)
+ wrapper = type('PyObj', (QObject,), wrapper_dict)
+
+ view = QWebView()
+ view.page().mainFrame().addToJavaScriptWindowObject('py_obj', wrapper())
+ view.setHtml(html)
+
+
+if __name__ == '__main__':
+ unittest.main()