summaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-08-11 15:18:52 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-08-11 19:14:57 -0300
commit5cc288b6796044d828ff463afa352703d6a59e90 (patch)
tree75da553d3a9a6805f03e2d5b225dcfd34e7563d3 /tests/QtDeclarative
parentf40f69f6e1a65f3b025a3035d4de0a4eaf23b05f (diff)
downloadpyside-5cc288b6796044d828ff463afa352703d6a59e90.tar.gz
pyside-5cc288b6796044d828ff463afa352703d6a59e90.tar.xz
pyside-5cc288b6796044d828ff463afa352703d6a59e90.zip
Created unit test for bug #951.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtDeclarative')
-rw-r--r--tests/QtDeclarative/CMakeLists.txt1
-rw-r--r--tests/QtDeclarative/bug_951.py31
-rw-r--r--tests/QtDeclarative/bug_951.qml7
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt
index 31ea6e7..279987e 100644
--- a/tests/QtDeclarative/CMakeLists.txt
+++ b/tests/QtDeclarative/CMakeLists.txt
@@ -7,6 +7,7 @@ PYSIDE_TEST(bug_825.py)
PYSIDE_TEST(bug_847.py)
PYSIDE_TEST(bug_915.py)
PYSIDE_TEST(bug_926.py)
+PYSIDE_TEST(bug_951.py)
PYSIDE_TEST(qdeclarativenetwork_test.py)
PYSIDE_TEST(qdeclarativeview_test.py)
PYSIDE_TEST(connect_python_qml.py)
diff --git a/tests/QtDeclarative/bug_951.py b/tests/QtDeclarative/bug_951.py
new file mode 100644
index 0000000..0cd8953
--- /dev/null
+++ b/tests/QtDeclarative/bug_951.py
@@ -0,0 +1,31 @@
+from PySide.QtDeclarative import QDeclarativeItem, qmlRegisterType, QDeclarativeView
+from PySide.QtCore import QUrl
+
+from helper import adjust_filename, TimedQApplication
+import unittest
+
+class MyItem(QDeclarativeItem):
+ COMPONENT_COMPLETE_CALLED = False
+ def __init__(self,parent=None):
+ super(MyItem, self).__init__(parent)
+ self.setObjectName("myitem")
+
+ def componentComplete(self):
+ MyItem.COMPONENT_COMPLETE_CALLED = True
+ super(MyItem, self).componentComplete()
+
+class TestRegisterQMLType(TimedQApplication):
+ def setup(self):
+ TimedQApplication.setup(self, 100 * 3) # 3s
+
+ def testSignalEmission(self):
+ qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem")
+
+ view = QDeclarativeView()
+ view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__)))
+
+ self.app.exec_()
+ self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/QtDeclarative/bug_951.qml b/tests/QtDeclarative/bug_951.qml
new file mode 100644
index 0000000..dd0a560
--- /dev/null
+++ b/tests/QtDeclarative/bug_951.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+import my.item 1.0
+Rectangle{
+ width:10
+ height:10
+ MyItem{ }
+}