summaryrefslogtreecommitdiffstats
path: root/libqsystemtest/qsystemtest.cpp
diff options
context:
space:
mode:
authorEd Baak <ed.baak@nokia.com>2010-07-23 09:49:19 +1000
committerEd Baak <ed.baak@nokia.com>2010-07-23 09:49:19 +1000
commitdecbc60035f65acaa1c225ea9a7ba4fb8634f0b9 (patch)
tree346e77d7404b501be05562a76b6e665acef5c94f /libqsystemtest/qsystemtest.cpp
parent2a10573f0d67739b3fdec31787016a6a3ec99126 (diff)
Tweak code so that we can import it in creator-qtest - AND - continue to support a command line version of qtuitestrunner.
Diffstat (limited to 'libqsystemtest/qsystemtest.cpp')
-rw-r--r--libqsystemtest/qsystemtest.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp
index bc3fa36..ab164b2 100644
--- a/libqsystemtest/qsystemtest.cpp
+++ b/libqsystemtest/qsystemtest.cpp
@@ -2261,9 +2261,14 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
}
TestProcess* proc = new TestProcess(this);
- proc->test = this;
+#ifdef QTCREATOR_QTEST
+ proc->setEnvironment(m_env);
+#else
proc->env = m_env;
proc->env << QString("QTUITEST_PORT=%1").arg(m_aut_port);
+#endif
+
+ proc->test = this;
#ifdef Q_OS_MAC
args << QString("-style=qtuitest");
@@ -2291,7 +2296,7 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
}
// Give it a little time for the slave to come up.
- wait(3000);
+ wait(100);
if (!connectToAut(timeout)) {
fail(QString("Could not connect to process '%1'.").arg(app));
@@ -2563,7 +2568,13 @@ bool QSystemTest::runsOnDevice()
*/
void QSystemTest::wait(int msecs)
{
- QTest::qWait(msecs);
+// QTest::qWait(msecs);
+ QTime t;
+ t.start();
+ while (t.elapsed() < msecs) {
+ qApp->processEvents();
+ }
+ qDebug() << "waited" << t.elapsed() << " ms";
}
/*!
@@ -2965,6 +2976,7 @@ void QSystemTest::abortTest()
#endif
}
+#ifndef QTCREATOR_QTEST
/*!
\internal
Print any special usage information which should be shown when test is launched
@@ -3003,6 +3015,7 @@ void QSystemTest::printUsage(int argc, char *argv[]) const
, DEFAULT_AUT_PORT
);
}
+#endif
#ifndef Q_QDOC
/*
@@ -3196,6 +3209,7 @@ bool QSystemTest::setQueryError( const QTestMessage &message )
return false; // query is NOT successfull
}
+#ifndef QTCREATOR_QTEST
/*!
\internal
Launch AUT and run the test.
@@ -3206,6 +3220,7 @@ int QSystemTest::runTest(int argc, char *argv[]) {
return QAbstractTest::runTest(argc, argv);
}
+#endif
/*!
\internal
@@ -3220,6 +3235,7 @@ bool QSystemTest::connectToAut(int timeout)
if (!m_test_app)
m_test_app = new QSystemTestMaster( this );
+ bool first_time = true;
QTime t;
t.start();
while (t.elapsed() < timeout && !isConnected()) {
@@ -3227,9 +3243,11 @@ bool QSystemTest::connectToAut(int timeout)
m_test_app->waitForConnected(2000);
if (!m_test_app->isConnected()) {
if (m_test_app->error() == QAbstractSocket::ConnectionRefusedError) {
- qLog(QtUitest) << qPrintable(QString("Connection refused while trying to connect to test app on %1:%2").arg(m_aut_host).arg(m_aut_port)) ;
+ if (first_time) {
+ qLog(QtUitest) << qPrintable(QString("Connection refused while trying to connect to test app on %1:%2. Retrying ... ").arg(m_aut_host).arg(m_aut_port)) ;
+ first_time = false;
+ }
}
- QTest::qWait(100);
}
}