aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-06-29 18:13:24 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:31 -0300
commitda39716cc95ca03f20c32928709b092a1989ce26 (patch)
treec3b60b20fbcf79837b9455c8f6cf5b703768689d
parentb6f38556bd8cfcc61c537701a61cde56b4f704cf (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>
-rw-r--r--PySide/QtCore/typesystem_core.xml1
-rw-r--r--tests/QtWebKit/CMakeLists.txt1
-rw-r--r--tests/QtWebKit/qvariantlist_property_test.py43
3 files changed, 45 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 1c0baf757..e42663a08 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -379,6 +379,7 @@
<inject-code class="target" position="end">
Shiboken::TypeResolver::createValueTypeResolver&lt;QString>("unicode");
Shiboken::TypeResolver::createValueTypeResolver&lt;QString>("str");
+ Shiboken::TypeResolver::createValueTypeResolver&lt;QVariantList>("QVariantList");
PySide::init(module);
Py_AtExit(QtCoreModuleExit);
</inject-code>
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()