Created unit test for bug #951.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
f40f69f6e1
commit
5cc288b679
3 changed files with 39 additions and 0 deletions
31
tests/QtDeclarative/bug_951.py
Normal file
31
tests/QtDeclarative/bug_951.py
Normal file
|
|
@ -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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue