diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-17 11:17:16 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-17 11:17:16 (GMT) |
commit | f136f7410a30b090646a58c1791e15adfa18de85 (patch) | |
tree | 823e5adc4ee03eaf65aa10d26b60fd9d2665ffff | |
parent | e97b1187391e16208a2da0e4c7f9e6daa540aa93 (diff) | |
download | Qt-f136f7410a30b090646a58c1791e15adfa18de85.zip Qt-f136f7410a30b090646a58c1791e15adfa18de85.tar.gz Qt-f136f7410a30b090646a58c1791e15adfa18de85.tar.bz2 |
fix the QScriptEngineDebugger::state() logic, add test, improve docs
-rw-r--r-- | src/scripttools/debugging/qscriptenginedebugger.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index ae58c89..f2245cc 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -126,7 +126,7 @@ public: mode in which it accepts input from the user. The evaluationResumed() signal is emitted when script evaluation is resumed, i.e, when execution control is given back to the script - engine. + engine. The state() function returns the debugger's current state. When calling QScriptEngine::evaluate() it is useful to pass a descriptive script name (file name) as second argument, as this is @@ -228,6 +228,7 @@ public: /*! \enum QScriptEngineDebugger::DebuggerState + \since 4.6 This enum specifies the current state of the debugger. @@ -396,6 +397,8 @@ void QScriptEngineDebugger::detach() } /*! + \since 4.6 + Returns the current state of the debugger. \sa evaluationResumed() @@ -404,7 +407,7 @@ void QScriptEngineDebugger::detach() QScriptEngineDebugger::DebuggerState QScriptEngineDebugger::state() const { Q_D(const QScriptEngineDebugger); - return (d->debugger && d->debugger->isInteractive() ? SuspendedState : RunningState); + return !d->debugger || !d->debugger->isInteractive() ? SuspendedState : RunningState; } /*! diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp index 5d9f56f..7f3f9f3 100644 --- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp +++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp @@ -111,9 +111,11 @@ void tst_QScriptEngineDebugger::attachAndDetach() { { QScriptEngineDebugger debugger; + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); debugger.attachTo(0); QScriptEngine engine; debugger.attachTo(&engine); + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); } { QScriptEngineDebugger debugger; |