diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-08-11 15:18:52 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:43 -0300 |
commit | a87d1142102d5bde730dd1186838227a9e003fc8 (patch) | |
tree | 2e5f53ebce05b5761f15dae3725d6e4ae11326c9 /tests | |
parent | 7942a9053d0dc0ebb7bc359b574fb97529985989 (diff) |
Created unit test for bug #951.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_951.py | 31 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_951.qml | 7 |
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index 31ea6e75e..279987ef3 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 000000000..0cd895315 --- /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 000000000..dd0a560e7 --- /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{ }
+}
|