blob: 667e763ad430cdd9a552b53bea0037d415305e74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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()
|