diff options
Diffstat (limited to 'libqsystemtest/qsystemtest.cpp')
-rw-r--r-- | libqsystemtest/qsystemtest.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index 11d6c5b..0dde6dd 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -2307,9 +2307,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"); @@ -2342,7 +2347,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)); @@ -2620,7 +2625,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"; } /*! @@ -2998,6 +3009,13 @@ QString QSystemTest::stopRecordingEvents() */ void QSystemTest::prompt( const QString &manualSteps ) { + if (manualSteps.contains(QRegExp("<.*>.*</.*>"))) + { + // Contains HTML, don't assume it's a series of steps + showPromptDialog(manualSteps); + return; + } + QStringList list = manualSteps.split("\n", QString::SkipEmptyParts); foreach( QString cmd, list) manualTest(cmd); @@ -3032,6 +3050,7 @@ void QSystemTest::abortTest() #endif } +#ifndef QTCREATOR_QTEST /*! \internal Print any special usage information which should be shown when test is launched @@ -3071,6 +3090,7 @@ void QSystemTest::printUsage(int argc, char *argv[]) const , DEFAULT_AUT_PORT ); } +#endif #ifndef Q_QDOC /* @@ -3264,6 +3284,7 @@ bool QSystemTest::setQueryError( const QTestMessage &message ) return false; // query is NOT successfull } +#ifndef QTCREATOR_QTEST /*! \internal Launch AUT and run the test. @@ -3274,6 +3295,7 @@ int QSystemTest::runTest(int argc, char *argv[]) { return QAbstractTest::runTest(argc, argv); } +#endif /*! \internal @@ -3288,6 +3310,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()) { @@ -3295,9 +3318,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); } } |