summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordac <qt-info@nokia.com>2010-08-05 09:42:42 +1000
committerdac <qt-info@nokia.com>2010-08-05 09:42:42 +1000
commit8d722390188b843ee60b65d80b13c9ee351c1a94 (patch)
treeca9719e4787fd262f517c135c6e9762967dd31c7
parent521c569277b0df2fa0e4c7849a8162823f53d3c9 (diff)
Ensure test application is killed at end of test run.
-rw-r--r--interpreter/builtins.js1
-rw-r--r--interpreter/qscriptsystemtest.cpp4
-rw-r--r--libqsystemtest/qsystemtest.cpp22
-rw-r--r--libqsystemtest/qsystemtest.h1
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 &paramete
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