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
51
tests/QtCore/qmetaobject_test.py
Normal file
51
tests/QtCore/qmetaobject_test.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''Tests for static methos conflicts with class methods'''
|
||||
|
||||
import unittest
|
||||
|
||||
from PySide.QtCore import *
|
||||
|
||||
class Foo(QFile):
|
||||
pass
|
||||
|
||||
class DynObject(QObject):
|
||||
def slot(self):
|
||||
pass
|
||||
|
||||
class qmetaobject_test(unittest.TestCase):
|
||||
def test_QMetaObject(self):
|
||||
qobj = QObject()
|
||||
qobj_metaobj = qobj.metaObject()
|
||||
self.assertEqual(qobj_metaobj.className(), "QObject")
|
||||
|
||||
obj = QFile()
|
||||
m = obj.metaObject()
|
||||
self.assertEqual(m.className(), "QFile")
|
||||
self.assertNotEqual(m.methodCount(), qobj_metaobj.methodCount())
|
||||
|
||||
obj = Foo()
|
||||
m = obj.metaObject()
|
||||
self.assertEqual(m.className(), "Foo")
|
||||
f = QFile()
|
||||
fm = f.metaObject()
|
||||
self.assertEqual(m.methodCount(), fm.methodCount())
|
||||
|
||||
def test_DynamicSlotSignal(self):
|
||||
o = DynObject()
|
||||
o2 = QObject()
|
||||
|
||||
method_count_base = o.metaObject().methodCount()
|
||||
|
||||
o.connect(o2, SIGNAL("bar()"), o.slot)
|
||||
slot_index = o.metaObject().indexOfMethod("slot()")
|
||||
|
||||
o.connect(o, SIGNAL("foo()"), o2, SIGNAL("bar()"))
|
||||
signal_index = o.metaObject().indexOfMethod("foo()");
|
||||
|
||||
self.assert_(slot_index != signal_index)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue