summaryrefslogtreecommitdiffstats
path: root/tests/QtScriptTools/debugger_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/QtScriptTools/debugger_test.py')
-rw-r--r--tests/QtScriptTools/debugger_test.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/QtScriptTools/debugger_test.py b/tests/QtScriptTools/debugger_test.py
index e525361..5634824 100644
--- a/tests/QtScriptTools/debugger_test.py
+++ b/tests/QtScriptTools/debugger_test.py
@@ -1,7 +1,7 @@
import unittest
-from PySide.QtCore import SIGNAL
+from PySide.QtCore import SIGNAL, QTimer
from PySide.QtScript import QScriptEngine
from PySide.QtScriptTools import QScriptEngineDebugger
@@ -13,29 +13,32 @@ class DebuggerTest(UsesQApplication):
UsesQApplication.setUp(self)
self.engine = QScriptEngine()
self.debugger = QScriptEngineDebugger()
- self.has_suspended = False
- self.has_resumed = False
+ self.has_suspended = 0
+ self.has_resumed = 0
+ self.count = 3
def suspended(self):
- self.has_suspended = True
- self.debugger.action(QScriptEngineDebugger.ContinueAction).trigger()
+ self.has_suspended += 1
+ # Will emit evaluationResumed until there are more instructions to be run
+ QTimer.singleShot(100, self.debugger.action(QScriptEngineDebugger.StepIntoAction).trigger)
def resumed(self):
- self.has_resumed = True
+ # Will be called when debugger.state() change from Suspended to Running
+ # except for the first time.
+ self.has_resumed += 1
def testBasic(self):
'''Interrupt and resume evaluation with QScriptEngineDebugger'''
+
self.debugger.attachTo(self.engine)
self.debugger.setAutoShowStandardWindow(False)
self.debugger.connect(SIGNAL('evaluationSuspended()'), self.suspended)
self.debugger.connect(SIGNAL('evaluationResumed()'), self.resumed)
self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger()
- self.engine.evaluate("3+4")
- self.debugger.action(QScriptEngineDebugger.ContinueAction).trigger()
- self.assert_(self.has_resumed)
- self.assert_(self.has_suspended)
-
+ self.engine.evaluate("3+4\n2+1\n5+1")
+ self.assertEqual(self.has_resumed, 2)
+ self.assertEqual(self.has_suspended, 3)
if __name__ == '__main__':
unittest.main()