aboutsummaryrefslogtreecommitdiffstats
path: root/tests/signals/bug_312.py
blob: 223b4e143e43953dab9f6ca1cfb0fe8185f39e98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
from PySide.QtCore import QObject, SIGNAL

class MultipleSlots(unittest.TestCase):
    def myCB(self):
        self._count += 1

    def testUnboundSignal(self):
        o = QObject()
        self._count  = 0
        for i in range(200):
            QObject.connect(o, SIGNAL("fire()"), lambda: self.myCB())

        o.emit(SIGNAL("fire()"))
        self.assertEqual(self._count, 200)

if __name__ == '__main__':
    unittest.main()