Created unit test for bug #312.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
ad58b05c54
commit
5825092e76
2 changed files with 33 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ PYSIDE_TEST(deepcopy_test.py)
|
||||||
PYSIDE_TEST(deletelater_test.py)
|
PYSIDE_TEST(deletelater_test.py)
|
||||||
PYSIDE_TEST(duck_punching_test.py)
|
PYSIDE_TEST(duck_punching_test.py)
|
||||||
PYSIDE_TEST(hash_test.py)
|
PYSIDE_TEST(hash_test.py)
|
||||||
|
PYSIDE_TEST(max_signals.py)
|
||||||
PYSIDE_TEST(missing_symbols_test.py)
|
PYSIDE_TEST(missing_symbols_test.py)
|
||||||
PYSIDE_TEST(python_conversion.py)
|
PYSIDE_TEST(python_conversion.py)
|
||||||
PYSIDE_TEST(qabs_test.py)
|
PYSIDE_TEST(qabs_test.py)
|
||||||
|
|
|
||||||
32
tests/QtCore/max_signals.py
Normal file
32
tests/QtCore/max_signals.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from PySide.QtCore import QObject, Signal, SIGNAL
|
||||||
|
|
||||||
|
class MyObject(QObject):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TestSignalLimitless(unittest.TestCase):
|
||||||
|
def test100DynamicSignals(self):
|
||||||
|
self.count = 0
|
||||||
|
def onSignal():
|
||||||
|
self.count += 1
|
||||||
|
|
||||||
|
#create 100 dynamic signals
|
||||||
|
o = MyObject()
|
||||||
|
for i in range(100):
|
||||||
|
o.connect(SIGNAL('sig%d()'%i), onSignal)
|
||||||
|
|
||||||
|
#chek if the signals are valid
|
||||||
|
m = o.metaObject()
|
||||||
|
for i in range(100):
|
||||||
|
self.assert_(m.indexOfSignal('sig%d()'%i) > 0)
|
||||||
|
|
||||||
|
#emit all 100 signals
|
||||||
|
for i in range(100):
|
||||||
|
o.emit(SIGNAL('sig%d()'%i))
|
||||||
|
|
||||||
|
self.assertEqual(self.count, 100)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue