summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-08-24 17:11:55 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-08-25 17:31:24 -0300
commit49ac670cfc106cccef0fac0681a92ea6db413a75 (patch)
tree6a551e01ab84983cefa95b10ee5e91a8f3709fc3
parent20e226bc663e88849cd269043ebc9b7e223d5c10 (diff)
downloadshiboken-49ac670cfc106cccef0fac0681a92ea6db413a75.tar.gz
shiboken-49ac670cfc106cccef0fac0681a92ea6db413a75.tar.xz
shiboken-49ac670cfc106cccef0fac0681a92ea6db413a75.zip
Avoid cyclic dependency on test.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/signals/lambda_gui_test.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/signals/lambda_gui_test.py b/tests/signals/lambda_gui_test.py
index e842ae2e..ba10590b 100644
--- a/tests/signals/lambda_gui_test.py
+++ b/tests/signals/lambda_gui_test.py
@@ -14,24 +14,33 @@ except ImportError:
from helper import UsesQApplication
if hasQtGui:
+ class Control:
+ def __init__(self):
+ self.arg = False
+
class QtGuiSigLambda(UsesQApplication):
def testButton(self):
#Connecting a lambda to a QPushButton.clicked()
obj = QPushButton('label')
- QObject.connect(obj, SIGNAL('clicked()'),
- lambda: setattr(obj, 'called', True))
+ ctr = Control()
+ func = lambda: setattr(ctr, 'arg', True)
+ QObject.connect(obj, SIGNAL('clicked()'), func)
obj.click()
- self.assert_(obj.called)
+ self.assert_(ctr.arg)
+ QObject.disconnect(obj, SIGNAL('clicked()'), func)
+
def testSpinButton(self):
#Connecting a lambda to a QPushButton.clicked()
obj = QSpinBox()
+ ctr = Control()
arg = 444
- QObject.connect(obj, SIGNAL('valueChanged(int)'),
- lambda x: setattr(obj, 'arg', 444))
+ func = lambda x: setattr(ctr, 'arg', 444)
+ QObject.connect(obj, SIGNAL('valueChanged(int)'), func)
obj.setValue(444)
- self.assertEqual(obj.arg, arg)
+ self.assertEqual(ctr.arg, arg)
+ QObject.disconnect(obj, SIGNAL('valueChanged(int)'), func)
if __name__ == '__main__':
unittest.main()