From a87d1142102d5bde730dd1186838227a9e003fc8 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Thu, 11 Aug 2011 15:18:52 -0300 Subject: Created unit test for bug #951. Reviewer: Marcelo Lira Luciano Wolf --- tests/QtDeclarative/CMakeLists.txt | 1 + tests/QtDeclarative/bug_951.py | 31 +++++++++++++++++++++++++++++++ tests/QtDeclarative/bug_951.qml | 7 +++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/QtDeclarative/bug_951.py create mode 100644 tests/QtDeclarative/bug_951.qml 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{ } +} -- cgit v1.2.3