aboutsummaryrefslogtreecommitdiffstats
path: root/tests/signals
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-07-08 10:47:24 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-07-08 11:27:01 -0300
commit693ae6d6c4073a483524af48e7a1a0ad1fba1131 (patch)
tree97255288855eed17ae9c04746514f9185683fb06 /tests/signals
parent83db5730319cc258e683a12567ba9362dbd07d45 (diff)
Modify multiple connections test to avoid use more then 50 slots
supported by PySide. Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/signals')
-rw-r--r--tests/signals/multiple_connections_gui_test.py16
-rw-r--r--tests/signals/multiple_connections_test.py17
2 files changed, 9 insertions, 24 deletions
diff --git a/tests/signals/multiple_connections_gui_test.py b/tests/signals/multiple_connections_gui_test.py
index 72feac08f..3bff7c3dc 100644
--- a/tests/signals/multiple_connections_gui_test.py
+++ b/tests/signals/multiple_connections_gui_test.py
@@ -12,11 +12,6 @@ except ImportError:
from helper import BasicPySlotCase, UsesQApplication
-def random_gen(count=100, largest=99, lowest=0):
- for i in range(count):
- yield random.randint(lowest, largest)
-
-
class MultipleSignalConnections(unittest.TestCase):
'''Base class for multiple signal connection testing'''
@@ -55,12 +50,11 @@ if hasQtGui:
def testSpinBoxValueChanged(self):
"""Multiple connections to QSpinBox.valueChanged(int)"""
- for test in random_gen(10):
- sender = QSpinBox()
- #FIXME if number of receivers if higher than 50, segfaults
- receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'valueChanged(int)', sender.setValue,
- receivers, (test,))
+ sender = QSpinBox()
+ #FIXME if number of receivers if higher than 50, segfaults
+ receivers = [BasicPySlotCase() for x in range(10)]
+ self.run_many(sender, 'valueChanged(int)', sender.setValue,
+ receivers, (1,))
if __name__ == '__main__':
unittest.main()
diff --git a/tests/signals/multiple_connections_test.py b/tests/signals/multiple_connections_test.py
index 5daeaab87..57ea89871 100644
--- a/tests/signals/multiple_connections_test.py
+++ b/tests/signals/multiple_connections_test.py
@@ -1,7 +1,6 @@
import sys
import unittest
-import random
from functools import partial
from PySide.QtCore import QObject, SIGNAL, QProcess
@@ -9,11 +8,6 @@ from PySide.QtCore import QObject, SIGNAL, QProcess
from helper import BasicPySlotCase, UsesQCoreApplication
-def random_gen(count=50, largest=49, lowest=0):
- for i in range(count):
- yield random.randint(lowest, largest)
-
-
class MultipleSignalConnections(unittest.TestCase):
'''Base class for multiple signal connection testing'''
@@ -28,10 +22,9 @@ class MultipleSignalConnections(unittest.TestCase):
if args is None:
args = tuple()
-
for rec in receivers:
rec.setUp()
- QObject.connect(sender, SIGNAL(signal), rec.cb)
+ self.assert_(QObject.connect(sender, SIGNAL(signal), rec.cb))
rec.args = tuple(args)
emitter(*args)
@@ -49,11 +42,9 @@ class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
class Dummy(QObject):
pass
- for test in random_gen(20):
- sender = Dummy()
- receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'foobar', partial(sender.emit,
- SIGNAL('foobar')), receivers, (test, ))
+ sender = Dummy()
+ receivers = [BasicPySlotCase() for x in range(10)]
+ self.run_many(sender, 'foobar', partial(sender.emit,SIGNAL('foobar')), receivers, (0, ))
class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):