Created new unittest model.
Separete unittest for module.
Only run unittest for compiled modules.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
471486732b
commit
ab918abc1e
211 changed files with 241 additions and 79 deletions
55
tests/QtCore/child_event_test.py
Normal file
55
tests/QtCore/child_event_test.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/python
|
||||
'''Test case for QObject.childEvent and QTimer.childEvent overloading'''
|
||||
|
||||
import unittest
|
||||
from time import sleep
|
||||
from PySide.QtCore import QObject, QTimer, QCoreApplication
|
||||
|
||||
from helper import UsesQCoreApplication
|
||||
|
||||
class ExtQObject(QObject):
|
||||
def __init__(self):
|
||||
QObject.__init__(self)
|
||||
self.child_event_received = False
|
||||
|
||||
def childEvent(self, event):
|
||||
QObject.childEvent(self, event)
|
||||
self.child_event_received = True
|
||||
|
||||
class ExtQTimer(QTimer):
|
||||
def __init__(self):
|
||||
QTimer.__init__(self)
|
||||
self.child_event_received = False
|
||||
|
||||
def childEvent(self, event):
|
||||
QTimer.childEvent(self, event)
|
||||
self.child_event_received = True
|
||||
|
||||
|
||||
class TestChildEvent(UsesQCoreApplication):
|
||||
'''Test case for QObject::childEvent and QTimer::childEvent'''
|
||||
|
||||
def setUp(self):
|
||||
UsesQCoreApplication.setUp(self)
|
||||
|
||||
def tearDown(self):
|
||||
UsesQCoreApplication.tearDown(self)
|
||||
|
||||
def testQObject(self):
|
||||
parent = ExtQObject()
|
||||
child = QObject()
|
||||
child.setParent(parent)
|
||||
print "parent seted"
|
||||
#self.assert_(parent.child_event_received)
|
||||
|
||||
"""
|
||||
def testQTimer(self):
|
||||
parent = ExtQTimer()
|
||||
child = QObject()
|
||||
child.setParent(parent)
|
||||
self.assert_(parent.child_event_received)
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue