Check if the same python object arrive on destroyed signal.

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
Renato Filho 2011-05-23 11:43:24 -03:00 • committed by Hugo Parente Lima
commit ed7b92d5d7

View file

@ -3,6 +3,7 @@
import unittest import unittest
import os import os
import sys
from tempfile import mkstemp from tempfile import mkstemp
from PySide.QtCore import QObject, QTimer, SIGNAL from PySide.QtCore import QObject, QTimer, SIGNAL
from helper import UsesQCoreApplication from helper import UsesQCoreApplication
@ -44,6 +45,7 @@ class TestTimeoutSignal(UsesQCoreApplication):
def testTimeoutSignal(self): def testTimeoutSignal(self):
#Test the QTimer timeout() signal #Test the QTimer timeout() signal
refCount = sys.getrefcount(self.timer)
QObject.connect(self.timer, SIGNAL('timeout()'), self.callback) QObject.connect(self.timer, SIGNAL('timeout()'), self.callback)
self.timer.start(4) self.timer.start(4)
self.watchdog.startTimer(10) self.watchdog.startTimer(10)
@ -51,6 +53,7 @@ class TestTimeoutSignal(UsesQCoreApplication):
self.app.exec_() self.app.exec_()
self.assert_(self.called) self.assert_(self.called)
self.assertEqual(sys.getrefcount(self.timer), refCount)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()