diff options
-rw-r--r-- | interpreter/builtins.js | 1 | ||||
-rw-r--r-- | interpreter/qscriptsystemtest.cpp | 4 | ||||
-rw-r--r-- | libqsystemtest/qsystemtest.cpp | 22 | ||||
-rw-r--r-- | libqsystemtest/qsystemtest.h | 1 |
4 files changed, 23 insertions, 5 deletions
diff --git a/interpreter/builtins.js b/interpreter/builtins.js index a30edec..e8f6e10 100644 --- a/interpreter/builtins.js +++ b/interpreter/builtins.js @@ -71,6 +71,7 @@ function initTestCase_global() /* called after every cleanupTestCase() */ function cleanupTestCase_global() { + killApplication(); } function verify() { diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp index bff6dff..641bfb4 100644 --- a/interpreter/qscriptsystemtest.cpp +++ b/interpreter/qscriptsystemtest.cpp @@ -583,6 +583,10 @@ int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶mete m_engine->setAgent(m_agent); } + if (QTest::testObject()) { + qDebug() << "Test already in progress?"; + return -1; + } int retval = QTest::qExec(&tc, parameters); testObject = 0; diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index 506521b..f41157d 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -1675,7 +1675,7 @@ void QSystemTest::keyClickHold( Qt::Key key, int duration, const QString &queryP if (queryFailed()) return; - QTest::qWait(duration); + wait(duration); if (m_keyclickhold_key) { m_keyclickhold_key = (Qt::Key)0; @@ -1793,7 +1793,7 @@ void QSystemTest::mouseClickHold( const QPoint &point, int duration, QFlags<Qt:: if (m_strict_mode) QFAIL( "ERROR: mouseClickHold is not allowed in strict mode" ); mousePress(point, buttons); - QTest::qWait(duration); + wait(duration); mouseRelease(point, buttons); } @@ -1821,7 +1821,7 @@ void QSystemTest::mouseClickHold( const QString &queryPath, int duration, QFlags if (m_strict_mode) QFAIL( "ERROR: mouseClickHold is not allowed in strict mode" ); mousePress(queryPath, buttons); - QTest::qWait(duration); + wait(duration); mouseRelease(queryPath, buttons); } @@ -2244,6 +2244,18 @@ void QSystemTest::startApplication( const QString &application, const QStringLis } /*! + Terminate any application(s) started by the test system. Normally, this won't be necessary + as startApplication will do this for you. + + \sa {startApplication} +*/ +void QSystemTest::killApplication() +{ + if (device_controller) + device_controller->killApplications(); +} + +/*! Returns true if the widget specified by \a queryPath exists and is currently visible to the user. @@ -2700,8 +2712,8 @@ bool QSystemTest::recordEvents( const QString &manualSteps, bool gui ) if (QTestIDE::instance()->isConnected()) { QTestIDE::instance()->eventRecordingStarted(currentFile(), currentLine(), manualSteps); m_recording_events = true; - while (!QTestIDE::instance()->mustStopEventRecording()) { - QTest::qWait( 50 ); + while (!QTestIDE::instance()->mustStopEventRecording()) { + wait( 50 ); } m_recording_events = false; diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h index 0486ced..fcfa3f5 100644 --- a/libqsystemtest/qsystemtest.h +++ b/libqsystemtest/qsystemtest.h @@ -274,6 +274,7 @@ public slots: // application management functions virtual void startApplication(const QString&, const QStringList& = QStringList(), int timeout = 5000, QSystemTest::StartApplicationFlags = QSystemTest::WaitForFocus); + virtual void killApplication(); void expectApplicationClose(bool); // low level simulators |