diff options
author | Ed Baak <ed.baak@nokia.com> | 2010-08-03 12:55:26 +1000 |
---|---|---|
committer | Ed Baak <ed.baak@nokia.com> | 2010-08-03 12:55:26 +1000 |
commit | 8894d43a5aefd4358835c97bdd3d47de823d694e (patch) | |
tree | 462ef48de267103806a01f481adaec5fbcfbf1f9 | |
parent | f581aeba37844c2b1be1590d506dabdb95a50157 (diff) | |
parent | 40d2b818e3299e8af6b7a7349871411fe026734c (diff) |
Merge commit 'origin/master' into research
Conflicts:
interpreter/qscriptsystemtest.cpp
interpreter/qtscript_bindings.cpp
interpreter/qtscript_bindings.h
libqsystemtest/libqsystemtest.pro
libqsystemtest/qabstracttest.cpp
libqsystemtest/qsystemtest.cpp
libqtuitest/libqtuitest.pri
qtuitest-host.pri
23 files changed, 235 insertions, 170 deletions
diff --git a/coreplugin/coreplugin.pro b/coreplugin/coreplugin.pro new file mode 100644 index 0000000..d847cc3 --- /dev/null +++ b/coreplugin/coreplugin.pro @@ -0,0 +1,56 @@ +TEMPLATE = lib +TARGET = Core +DESTDIR = $$BUILDROOT/lib +CONFIG += static +INCLUDEPATH += .. ../botan/build +LIBS+=-L$$BUILDROOT/lib -lBotan + +HEADERS +=\ + ssh/sftpchannel.h \ + ssh/sftpchannel_p.h \ + ssh/sftpdefs.h \ + ssh/sftpincomingpacket_p.h \ + ssh/sftpoperation_p.h \ + ssh/sftpoutgoingpacket_p.h \ + ssh/sftppacket_p.h \ + ssh/sshbotanconversions_p.h \ + ssh/sshcapabilities_p.h \ + ssh/sshchannel_p.h \ + ssh/sshchannelmanager_p.h \ + ssh/sshconnection.h \ + ssh/sshconnection_p.h \ + ssh/sshcryptofacility_p.h \ + ssh/sshdelayedsignal_p.h \ + ssh/ssherrors.h \ + ssh/sshexception_p.h \ + ssh/sshincomingpacket_p.h \ + ssh/sshkeyexchange_p.h \ + ssh/sshkeygenerator.h \ + ssh/sshoutgoingpacket_p.h \ + ssh/sshpacket_p.h \ + ssh/sshpacketparser_p.h \ + ssh/sshremoteprocess.h \ + ssh/sshremoteprocess_p.h \ + ssh/sshsendfacility_p.h + +SOURCES +=\ + ssh/sftpchannel.cpp \ + ssh/sftpdefs.cpp \ + ssh/sftpincomingpacket.cpp \ + ssh/sftpoperation.cpp \ + ssh/sftpoutgoingpacket.cpp \ + ssh/sftppacket.cpp \ + ssh/sshcapabilities.cpp \ + ssh/sshchannel.cpp \ + ssh/sshchannelmanager.cpp \ + ssh/sshconnection.cpp \ + ssh/sshcryptofacility.cpp \ + ssh/sshdelayedsignal.cpp \ + ssh/sshincomingpacket.cpp \ + ssh/sshkeyexchange.cpp \ + ssh/sshkeygenerator.cpp \ + ssh/sshoutgoingpacket.cpp \ + ssh/sshpacket.cpp \ + ssh/sshpacketparser.cpp \ + ssh/sshremoteprocess.cpp \ + ssh/sshsendfacility.cpp diff --git a/features/systemtest.prf b/features/systemtest.prf index 72bc6e4..61b12e9 100644 --- a/features/systemtest.prf +++ b/features/systemtest.prf @@ -10,16 +10,16 @@ unix:!mac:!symbian { fi QMAKE_EXTRA_TARGETS+=symlink -# testapp_symlink.commands = \ -# for app in $$TESTAPPS; do \ -# APPPATH=$$BUILDROOT/tests/qtuitest/testapps/\$\$app; \ -# [ -d \$\$APPPATH ] || continue; \ -# ln -sf \$\$APPPATH/\$\$app $$BUILDDIR/\$\$app; \ -# done -# QMAKE_EXTRA_TARGETS+=testapp_symlink + testapp_symlink.commands = \ + for app in $$TESTAPPS; do \ + APPPATH=$$BUILDROOT/tests/qtuitest/testapps/\$\$app; \ + [ -d \$\$APPPATH ] || continue; \ + ln -sf \$\$APPPATH/\$\$app $$BUILDDIR/\$\$app; \ + done + QMAKE_EXTRA_TARGETS+=testapp_symlink test.commands = PATH=$$BUILDDIR:$$BUILDROOT/bin:\$\$PATH QTUITEST_INCLUDE_PATH=$$SRCROOT/tests/shared:\$\$QTUITEST_INCLUDE_PATH $$[QT_INSTALL_BINS]/qtuitestrunner $$BUILDDIR/$$SOURCES $(ARGS) -# test.depends = symlink testapp_symlink + test.depends = symlink testapp_symlink test.depends = symlink QMAKE_EXTRA_TARGETS+=test diff --git a/interpreter/interpreter.pro b/interpreter/interpreter.pro index 5eb648d..a424426 100644 --- a/interpreter/interpreter.pro +++ b/interpreter/interpreter.pro @@ -17,11 +17,9 @@ TEMPLATE=app VPATH+=$$PWD INCLUDEPATH+=$$PWD INCLUDEPATH+=$$SRCROOT -INCLUDEPATH+=$$SRCROOT/libqtuitest INCLUDEPATH+=$$SRCROOT/libqsystemtest QT+=script network TARGET=qtuitestrunner -LIBS+=-L$$BUILDROOT/lib -lBotan !symbian { MOC_DIR=$$OUT_PWD/.moc @@ -31,17 +29,17 @@ LIBS+=-L$$BUILDROOT/lib -lBotan INSTALLS+=target } -symbian { - TARGET.EPOCALLOWDLLDATA=1 - TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData - MOC_DIR=$$OUT_PWD/moc - OBJECTS_DIR=$$OUT_PWD/obj - LIBS += -L$$OUT_PWD -lqsystemtest -lqtuitest -} +#symbian { +# TARGET.EPOCALLOWDLLDATA=1 +# TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData +# MOC_DIR=$$OUT_PWD/moc +# OBJECTS_DIR=$$OUT_PWD/obj +# LIBS += -L$$OUT_PWD -lqsystemtest +#} win32 { - CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqsystemtest/debug -lqsystemtestd -L$$BUILDROOT/libqtuitest -lqtuitestd - CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqsystemtest/release -lqsystemtest -L$$BUILDROOT/libqtuitest -lqtuitest -L$$BUILDROOT/libqtslave/release -lqtslave + CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqsystemtest/debug -lqsystemtestd + CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqsystemtest/release -lqsystemtest target.path=$$[QT_INSTALL_BINS] INSTALLS+=target !equals(QMAKE_CXX, "g++") { @@ -50,12 +48,12 @@ win32 { } !win32:!symbian:!mac { - LIBS += -L$$BUILDROOT/lib -lqsystemtest -lqtuitest + LIBS += -L$$BUILDROOT/lib -lqsystemtest -lBotan -lCore } mac { CONFIG-=app_bundle - CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest_debug -lqtuitest_debug - CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest -lqtuitest + CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest_debug + CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest } diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp index 0f9606f..deb4a52 100644 --- a/interpreter/qscriptsystemtest.cpp +++ b/interpreter/qscriptsystemtest.cpp @@ -717,6 +717,11 @@ int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶mete test_result.setCurrentTestCase(QFileInfo(filename).baseName()); QtScriptTest tc(filename, script, &m_engine); + + if (tc.status() != QtScriptTest::StatusNormal) { + return -1; + } + testObject = &tc; qScriptRegisterMetaType(&m_engine, variantToScriptValue, variantFromScriptValue); @@ -734,7 +739,7 @@ int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶mete } // If an IDE is connected, set the agent to enable script debugging - if (testIDE() && testIDE()->isConnected()) { + if (QTestIDE::instance()->isConnected()) { m_engine.setAgent(m_agent); } @@ -1203,8 +1208,8 @@ void QScriptSystemTest::scriptPositionChange(qint64 scriptId, int line, int colu } else { functionName = ctxInfo.functionName(); } - if (testIDE()->queryBreakpoint(ctxInfo.fileName(), ctxInfo.lineNumber(), functionName, m_contextDepth)) { - testIDE()->breakpointContext(m_engine.currentContext()); + if (QTestIDE::instance()->queryBreakpoint(ctxInfo.fileName(), ctxInfo.lineNumber(), functionName, m_contextDepth)) { + QTestIDE::instance()->breakpointContext(m_engine.currentContext()); } } } diff --git a/interpreter/qtscript_bindings.cpp b/interpreter/qtscript_bindings.cpp index 5b33d27..9661c65 100644 --- a/interpreter/qtscript_bindings.cpp +++ b/interpreter/qtscript_bindings.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <qtestide.h> #include "qscriptengine.h" #include "qscriptvalue.h" #include "qscriptvalueiterator.h" @@ -239,7 +240,7 @@ int QtScriptTest::qt_metacall(QMetaObject::Call _c, int _id, void **_a) } QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptData, QScriptEngine *engine) - : QObject(), m_testFilePath(testFilePath), m_engine(engine) + : QObject(), m_testFilePath(testFilePath), m_engine(engine), m_status(StatusNotStarted) { if (m_testFilePath.isEmpty()) m_testFilePath = qgetenv("Q_TEST_FILE"); @@ -268,6 +269,8 @@ QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptDat if (synChk.state() != QScriptSyntaxCheckResult::Valid) { test_result.addFailure(QString("SyntaxError: %1").arg(synChk.errorMessage()), m_testFilePath, synChk.errorLineNumber()); + QTestIDE::instance()->scriptSyntaxError(synChk.errorMessage(), m_testFilePath, synChk.errorLineNumber()); + m_status = StatusSyntaxError; return; } @@ -282,6 +285,7 @@ QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptDat QString backtrace = m_engine->uncaughtExceptionBacktrace().join("\n"); test_result.addFailure(QString("Script Error: %1\n%2").arg(error).arg(backtrace), m_testFilePath, -1); + m_status = StatusException; return; } QScriptValue testcase = m_engine->globalObject().property("testcase"); @@ -340,8 +344,15 @@ QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptDat staticMetaObject.d.stringdata = stringdata->constData(); staticMetaObject.d.data = data->constData(); staticMetaObject.d.extradata = 0; + + m_status = StatusNormal; } QtScriptTest::~QtScriptTest() { } + +QtScriptTest::Status QtScriptTest::status() +{ + return m_status; +} diff --git a/interpreter/qtscript_bindings.h b/interpreter/qtscript_bindings.h index 7827859..cf684f8 100644 --- a/interpreter/qtscript_bindings.h +++ b/interpreter/qtscript_bindings.h @@ -54,6 +54,15 @@ class QtScriptTest : public QObject { public: + + enum Status + { + StatusNotStarted, + StatusNormal, + StatusSyntaxError, + StatusException + }; + QtScriptTest(QString const &testFilePath = QString(), QString const &scriptData = QString(), QScriptEngine *engine = 0); virtual ~QtScriptTest(); @@ -65,6 +74,7 @@ public: QString testFilePath() const { return m_testFilePath; } QScriptEngine* engine() { return m_engine; } + Status status(); private: bool newRow(const char *dataTag); @@ -80,6 +90,7 @@ private: QString m_testFilePath; QScriptEngine* m_engine; QTestResult test_result; + Status m_status; }; #endif diff --git a/libqsystemtest/desktoptestcontrol.cpp b/libqsystemtest/desktoptestcontrol.cpp index 2529c5e..085a220 100644 --- a/libqsystemtest/desktoptestcontrol.cpp +++ b/libqsystemtest/desktoptestcontrol.cpp @@ -6,6 +6,11 @@ using namespace Qt4Test; +DesktopTestControl* DesktopTestControl::instance() +{ + static DesktopTestControl instance; + return &instance; +} DesktopTestControl::DesktopTestControl() : TestControl() @@ -58,8 +63,6 @@ bool DesktopTestControl::startApplication( const QString &application, const QSt bool DesktopTestControl::killApplication( const QString &application, QString &reply ) { - return true; - if (!proc) return false; diff --git a/libqsystemtest/desktoptestcontrol.h b/libqsystemtest/desktoptestcontrol.h index f8dd9dd..9b1a301 100644 --- a/libqsystemtest/desktoptestcontrol.h +++ b/libqsystemtest/desktoptestcontrol.h @@ -101,6 +101,7 @@ class DesktopTestControl : public TestControl { Q_OBJECT public: + static DesktopTestControl* instance(); DesktopTestControl(); virtual ~DesktopTestControl(); diff --git a/libqsystemtest/libqsystemtest.pro b/libqsystemtest/libqsystemtest.pro index b93e10e..60d8987 100644 --- a/libqsystemtest/libqsystemtest.pro +++ b/libqsystemtest/libqsystemtest.pro @@ -8,14 +8,19 @@ FORMS +=\ SEMI_PRIVATE_HEADERS += \ qsystemtestmaster_p.h \ qtestremote_p.h \ + qtestprotocol_p.h \ qtestverifydlg_p.h HEADERS +=\ qabstracttest.h \ qsystemtest.h \ qtestide.h \ - qtestprotocol.h \ - testdevicecontrol.h + testcontrol.h \ + maemotestcontrol.h \ + meegotestcontrol.h \ + symbiantestcontrol.h \ + desktoptestcontrol.h \ + customtestcontrol.h SOURCES +=\ qabstracttest.cpp \ @@ -26,59 +31,12 @@ SOURCES +=\ qsystemtest_p.cpp \ qsystemtestmaster.cpp \ qtestprotocol.cpp \ - testdevicecontrol.cpp - -HEADERS +=\ - ../coreplugin/ssh/sftpchannel.h \ - ../coreplugin/ssh/sftpchannel_p.h \ - ../coreplugin/ssh/sftpdefs.h \ - ../coreplugin/ssh/sftpincomingpacket_p.h \ - ../coreplugin/ssh/sftpoperation_p.h \ - ../coreplugin/ssh/sftpoutgoingpacket_p.h \ - ../coreplugin/ssh/sftppacket_p.h \ - ../coreplugin/ssh/sshbotanconversions_p.h \ - ../coreplugin/ssh/sshcapabilities_p.h \ - ../coreplugin/ssh/sshchannel_p.h \ - ../coreplugin/ssh/sshchannelmanager_p.h \ - ../coreplugin/ssh/sshconnection.h \ - ../coreplugin/ssh/sshconnection_p.h \ - ../coreplugin/ssh/sshcryptofacility_p.h \ - ../coreplugin/ssh/sshdelayedsignal_p.h \ - ../coreplugin/ssh/ssherrors.h \ - ../coreplugin/ssh/sshexception_p.h \ - ../coreplugin/ssh/sshincomingpacket_p.h \ - ../coreplugin/ssh/sshkeyexchange_p.h \ - ../coreplugin/ssh/sshkeygenerator.h \ - ../coreplugin/ssh/sshoutgoingpacket_p.h \ - ../coreplugin/ssh/sshpacket_p.h \ - ../coreplugin/ssh/sshpacketparser_p.h \ - ../coreplugin/ssh/sshremoteprocess.h \ - ../coreplugin/ssh/sshremoteprocess_p.h \ - ../coreplugin/ssh/sshsendfacility_p.h - -SOURCES +=\ - ../coreplugin/ssh/sftpchannel.cpp \ - ../coreplugin/ssh/sftpdefs.cpp \ - ../coreplugin/ssh/sftpincomingpacket.cpp \ - ../coreplugin/ssh/sftpoperation.cpp \ - ../coreplugin/ssh/sftpoutgoingpacket.cpp \ - ../coreplugin/ssh/sftppacket.cpp \ - ../coreplugin/ssh/sshcapabilities.cpp \ - ../coreplugin/ssh/sshchannel.cpp \ - ../coreplugin/ssh/sshchannelmanager.cpp \ - ../coreplugin/ssh/sshconnection.cpp \ - ../coreplugin/ssh/sshcryptofacility.cpp \ - ../coreplugin/ssh/sshdelayedsignal.cpp \ - ../coreplugin/ssh/sshincomingpacket.cpp \ - ../coreplugin/ssh/sshkeyexchange.cpp \ - ../coreplugin/ssh/sshkeygenerator.cpp \ - ../coreplugin/ssh/sshoutgoingpacket.cpp \ - ../coreplugin/ssh/sshpacket.cpp \ - ../coreplugin/ssh/sshpacketparser.cpp \ - ../coreplugin/ssh/sshremoteprocess.cpp \ - ../coreplugin/ssh/sshsendfacility.cpp - - + testcontrol.cpp \ + maemotestcontrol.cpp \ + meegotestcontrol.cpp \ + symbiantestcontrol.cpp \ + desktoptestcontrol.cpp \ + customtestcontrol.cpp VPATH+=$$PWD INCLUDEPATH+=$$PWD @@ -91,9 +49,13 @@ TEMPLATE=lib TARGET=qsystemtest TARGET=$$qtLibraryTarget($$TARGET) HEADERS*=$$SEMI_PRIVATE_HEADERS $$PRIVATE_HEADERS +<<<<<<< HEAD #INCLUDEPATH+=$$SRCROOT/libqtuitest +======= +CONFIG+=qtestlib staticlib +>>>>>>> origin/master QT+=network script -LIBS+=-L$$BUILDROOT/lib -lBotan +LIBS+=-L$$BUILDROOT/lib -lBotan -lCore unix:!symbian { DESTDIR=$$BUILDROOT/lib @@ -104,12 +66,10 @@ unix:!symbian { symbian { TARGET.EPOCALLOWDLLDATA=1 TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData - LIBS+=-L$$OUT_PWD -lqtuitest -lws32 -leuser -lcone + LIBS+=-L$$OUT_PWD -lws32 -leuser -lcone } win32 { - CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd - CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest target.path=$$[QT_INSTALL_BINS] INSTALLS+=target !equals(QMAKE_CXX, "g++") { @@ -118,8 +78,6 @@ win32 { } mac { - CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest_debug - CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest DEFINES+=sighandler_t=sig_t } diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index fc0dece..d8dab99 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -42,7 +42,7 @@ #include <qsystemtest.h> #include "qsystemtestmaster_p.h" #include "qtuitest_config.h" -//#include "gracefulquit.h" +#include "qtestide.h" #include "ui_recorddlg.h" #ifdef QTCREATOR_QTEST @@ -249,13 +249,13 @@ QSystemTest::QSystemTest() , m_config_id() , m_recording_events(false) , m_expect_app_close(false) - , m_qtest_ide(new QTestIDE(this)) { m_env.clear(); ssh_param.host = "127.0.0.1"; ssh_param.port = 22; device_controller = 0; + QTestIDE::instance()->setSystemTest(this); (void)qMetaTypeId<RecordEvent>(); (void)qMetaTypeId< QList<RecordEvent> >(); qRegisterMetaType<QTestMessage>("QTestMessage"); @@ -274,7 +274,6 @@ QSystemTest::~QSystemTest() delete device_controller; delete event_timer; delete m_test_app; - delete m_qtest_ide; while (expected_msg_boxes.count() > 0) delete expected_msg_boxes.takeFirst(); } @@ -913,7 +912,7 @@ void QSystemTest::verifyImage( const QString &expectedName, const QString &query if ( !actualIm.save(expectedFilename, "PNG", 0) ) { test_result.addWarning(QString("Failed to save image to %1!").arg(expectedFilename)); } else { - testIDE()->newTestData(expectedFilename); + QTestIDE::instance()->newTestData(expectedFilename); } snapshotOk = true; } else { @@ -2595,8 +2594,8 @@ void QSystemTest::processCommandLine( QStringList &args ) return; } - testIDE()->openRemote( host, port ); - connect(testIDE(), SIGNAL(abort()), this, SLOT(abortTest())); + QTestIDE::instance()->openRemote( host, port ); + connect(QTestIDE::instance(), SIGNAL(abort()), this, SLOT(abortTest())); } else if ( !arg.compare("-autip", Qt::CaseInsensitive) || !arg.compare("-authost", Qt::CaseInsensitive) ) { it.remove(); if (!it.hasNext()) throwFatal(QString("Expected a value after %1").arg(arg)); @@ -2697,15 +2696,15 @@ bool QSystemTest::recordEvents( const QString &manualSteps, bool gui ) m_recorded_code = QString(); if (!queryPassed( "OK", "", QTestMessage("startEventRecording"))) return false; if (gui) { - if (testIDE()->isConnected()) { - testIDE()->eventRecordingStarted(currentFile(), currentLine(), manualSteps); + if (QTestIDE::instance()->isConnected()) { + QTestIDE::instance()->eventRecordingStarted(currentFile(), currentLine(), manualSteps); m_recording_events = true; - while (!testIDE()->mustStopEventRecording()) { + while (!QTestIDE::instance()->mustStopEventRecording()) { wait( 50 ); } m_recording_events = false; - if (testIDE()->eventRecordingAborted()) { + if (QTestIDE::instance()->eventRecordingAborted()) { skip("Event recording aborted.", SkipSingle ); } } else { @@ -2938,7 +2937,7 @@ bool QSystemTest::fail(QString const &message) // If we saved it, let the IDE know. QFileInfo info(currentDataPath() + "/failure_" + config + ".png"); if (info.exists()) { - testIDE()->failureScreenshot(info.canonicalFilePath(), currentFile(), currentLine(), test_result.curTestFunc(true)); + QTestIDE::instance()->failureScreenshot(info.canonicalFilePath(), currentFile(), currentLine(), test_result.curTestFunc(false)); } } @@ -3470,11 +3469,6 @@ bool QSystemTest::runAsManualTest(void) return m_run_as_manual_test; } -QTestIDE *QSystemTest::testIDE() -{ - return m_qtest_ide; -} - /*! \internal Pass any configuration values to the system under test diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h index e98e812..c6fc7ef 100644 --- a/libqsystemtest/qsystemtest.h +++ b/libqsystemtest/qsystemtest.h @@ -44,7 +44,6 @@ #include "qabstracttest.h" #include "qtestprotocol_p.h" -#include "qtestide.h" #include "recordevent_p.h" #include <testcontrol.h> @@ -470,8 +469,6 @@ public: QString PATH(); QString which( const QString &appName ); - QTestIDE *testIDE(); - signals: void appGainedFocus(QString const &appName); void appBecameIdle(QString const &appName); @@ -556,7 +553,6 @@ private: bool m_expect_app_close; int m_query_count; bool m_skip_current_function; - QTestIDE *m_qtest_ide; #ifdef Q_QDOC /* Functions where implementation is in QtScript */ diff --git a/libqsystemtest/qsystemtest_p.cpp b/libqsystemtest/qsystemtest_p.cpp index e9003f8..d2f6ee3 100644 --- a/libqsystemtest/qsystemtest_p.cpp +++ b/libqsystemtest/qsystemtest_p.cpp @@ -42,7 +42,7 @@ #include <qsystemtest.h> #include "qsystemtestmaster_p.h" #include "qtestverifydlg_p.h" -#include "qtestremote_p.h" +#include "qtestide.h" #include "recordevent_p.h" #include "qtuitest_config.h" #include "ui_manualverificationdlg.h" @@ -77,8 +77,8 @@ */ bool QSystemTest::learnImage(const QImage &actual, const QImage &expected, const QString &comment) { - if (m_qtest_ide->isConnected()) { - return m_qtest_ide->verifyImage(actual.isNull() ? QPixmap() : QPixmap::fromImage(actual), + if (QTestIDE::instance()->isConnected()) { + return QTestIDE::instance()->verifyImage(actual.isNull() ? QPixmap() : QPixmap::fromImage(actual), expected.isNull() ? QPixmap() : QPixmap::fromImage(expected), comment); } else { @@ -698,7 +698,7 @@ void QSystemTest::recordEvents(QList<RecordEvent> const& events) m_recorded_events_edit->moveCursor(QTextCursor::End); m_recorded_events_edit->ensureCursorVisible(); } - m_qtest_ide->recordedCode(m_recorded_code); + QTestIDE::instance()->recordedCode(m_recorded_code); } } /* diff --git a/libqsystemtest/qtestide.cpp b/libqsystemtest/qtestide.cpp index 2e9decd..cb4a271 100644 --- a/libqsystemtest/qtestide.cpp +++ b/libqsystemtest/qtestide.cpp @@ -46,9 +46,15 @@ #include <QScriptValueIterator> #include <QPixmap> -QTestIDE::QTestIDE(QSystemTest *sysTest) +QTestIDE* QTestIDE::instance() +{ + static QTestIDE instance; + return &instance; +} + +QTestIDE::QTestIDE() + : m_sysTest(0) { - m_sysTest = sysTest; must_stop_event_recording = false; event_recording_aborted = false; } @@ -57,6 +63,11 @@ QTestIDE::~QTestIDE() { } +void QTestIDE::setSystemTest(QSystemTest *sysTest) +{ + m_sysTest = sysTest; +} + /*! \internal Opens a socket connection to a remote test tool and uses the connection to @@ -72,6 +83,15 @@ bool QTestIDE::isConnected() return m_remote.isConnected(); } +void QTestIDE::scriptSyntaxError(const QString& errorMsg, const QString& file, int line) +{ + if (errorMsg.isEmpty()) { + qWarning(QString("Syntax Error in %1, near line %2").arg(file).arg(line).toLatin1()); + } else { + qWarning(QString("Syntax Error in %1, near line %2: %3").arg(file).arg(line).arg(errorMsg).toLatin1()); + } +} + bool QTestIDE::queryBreakpoint(const QString& file, int line, const QString& function, int depth) { if (m_remote.isConnected()) { @@ -192,7 +212,7 @@ void QTestIDE::contextToMap(const QScriptContext* scriptContext, QVariantMap &co contextMap["line"] = ctxInfo.lineNumber(); if (ctxInfo.functionName().isEmpty()) { - contextMap["function"] = m_sysTest->currentTestFunction(); + contextMap["function"] = m_sysTest ? m_sysTest->currentTestFunction() : QString("unknown"); } else { contextMap["function"] = ctxInfo.functionName(); contextMap["funcStart"] = ctxInfo.functionStartLineNumber(); diff --git a/libqsystemtest/qtestide.h b/libqsystemtest/qtestide.h index 1f7b27c..0349b86 100644 --- a/libqsystemtest/qtestide.h +++ b/libqsystemtest/qtestide.h @@ -54,13 +54,17 @@ class QSYSTEMTEST_EXPORT QTestIDE : public QObject Q_OBJECT public: - QTestIDE(QSystemTest*); + static QTestIDE* instance(); + + QTestIDE(); virtual ~QTestIDE(); - + void setSystemTest( QSystemTest* ); + void openRemote( const QString &ip, int port ); bool isConnected(); // virtual void processMessage( QTestMessage *msg ); + void scriptSyntaxError(const QString&, const QString&, int); bool queryBreakpoint(const QString&, int, const QString&, int); void breakpointContext(const QScriptContext*); @@ -75,6 +79,7 @@ public: signals: void abort(); + void syntaxError(const QString&, const QString&, int); private: void contextToMap(const QScriptContext* scriptContext, QVariantMap&); diff --git a/libqsystemtest/testcontrol.cpp b/libqsystemtest/testcontrol.cpp index 54ae0be..75cf279 100644 --- a/libqsystemtest/testcontrol.cpp +++ b/libqsystemtest/testcontrol.cpp @@ -82,14 +82,19 @@ TestControl* TestController::controlFactory() { if (test_device_type == Maemo) return new MaemoTestControl(ssh_param); +// return MaemoTestControl::instance(ssh_param); else if (test_device_type == Desktop) - return new DesktopTestControl(); +// return new DesktopTestControl(); + return DesktopTestControl::instance(); else if (test_device_type == MeeGo) return new MeeGoTestControl(); +// return MeeGoTestControl::instance(); else if (test_device_type == Custom) return new CustomTestControl(); +// return CustomTestControl::instance(); else if (test_device_type == Symbian) return new SymbianTestControl(); +// return SymbianTestControl::instance(); return 0; } @@ -106,7 +111,7 @@ bool TestController::startApplication( const QString &application, const QString { TestControl *ctrl = controlFactory(); if (ctrl) { - device_controls.append(ctrl); +// device_controls.append(ctrl); if (ctrl->startApplication(application, arguments, styleQtUITest, environment, reply)) { started_applications += application; return true; @@ -119,7 +124,7 @@ bool TestController::killApplication( const QString &application, QString &reply { TestControl *ctrl = controlFactory(); if (ctrl) { - device_controls.append(ctrl); +// device_controls.append(ctrl); return ctrl->killApplication(application, reply); } return false; diff --git a/libqtslave/libqtslave.pro b/libqtslave/libqtslave.pro index eba1752..bbcd350 100644 --- a/libqtslave/libqtslave.pro +++ b/libqtslave/libqtslave.pro @@ -6,6 +6,8 @@ QT+=network DEFINES+=QTSLAVE_TARGET INCLUDEPATH+=$$PWD +INCLUDEPATH += $$SRCROOT/libqtuitest + include($$SRCROOT/libqtuitest/libqtuitest.pri) # we need to set a MAEMO define since this is not yet in Qt @@ -50,6 +52,6 @@ SOURCES += \ qtestwidgets.cpp maemo5|maemo6 { - target.path = /usr/local/lib + target.path = $$[QT_INSTALL_LIBS] INSTALLS += target } diff --git a/libqtuitest/libqtuitest.pro b/libqtuitest/libqtuitest.pro index 8540bfb..3f96f64 100644 --- a/libqtuitest/libqtuitest.pro +++ b/libqtuitest/libqtuitest.pro @@ -84,6 +84,6 @@ TARGET=$$qtLibraryTarget($$TARGET) CONFIG-=debug_and_release_target maemo5|maemo6 { - target.path = /usr/local/lib - INSTALLS += target + target.path=$$[QT_INSTALL_LIBS] + INSTALLS+=target } diff --git a/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro index cce04df..ff5dd3a 100644 --- a/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro +++ b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro @@ -33,11 +33,11 @@ TARGET=$$qtLibraryTarget($$TARGET) include($$SRCROOT/libqtuitest/libqtuitest.pri) +target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets + unix:!symbian { MOC_DIR=$$OUT_PWD/.moc OBJECTS_DIR=$$OUT_PWD/.obj - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target } symbian { @@ -46,12 +46,4 @@ symbian { OBJECTS_DIR=$$OUT_PWD/obj } -win32 { - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target -} - -maemo5|maemo6 { - target.path = /usr/local/lib - INSTALLS += target -} +INSTALLS+=target diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro index 7291b58..9b0e7bc 100644 --- a/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro +++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro @@ -23,11 +23,11 @@ TARGET=$$qtLibraryTarget($$TARGET) include($$SRCROOT/libqtuitest/libqtuitest.pri) +target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets + unix:!symbian { MOC_DIR=$$OUT_PWD/.moc OBJECTS_DIR=$$OUT_PWD/.obj - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target } symbian { @@ -35,14 +35,4 @@ symbian { MOC_DIR=$$OUT_PWD/moc OBJECTS_DIR=$$OUT_PWD/obj } - -win32 { - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target -} - - -maemo5|maemo6 { - target.path = /usr/local/lib - INSTALLS += target -} +INSTALLS += target diff --git a/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro index 111d326..986f04e 100644 --- a/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro +++ b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro @@ -70,11 +70,11 @@ TARGET=$$qtLibraryTarget($$TARGET) include($$SRCROOT/libqtuitest/libqtuitest.pri) + +target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets unix:!symbian { MOC_DIR=$$OUT_PWD/.moc OBJECTS_DIR=$$OUT_PWD/.obj - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target } symbian { @@ -84,11 +84,7 @@ symbian { OBJECTS_DIR=$$OUT_PWD/obj LIBS+= -lws32 -leuser -lcone } - -win32 { - target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets - INSTALLS+=target -} +INSTALLS += target contains(QT_CONFIG, webkit) { QT+=webkit @@ -97,7 +93,3 @@ contains(QT_CONFIG, webkit) { } -maemo5|maemo6 { - target.path = /usr/local/lib - INSTALLS += target -} diff --git a/plugins/styles/qtuitest/qtuitest.pro b/plugins/styles/qtuitest/qtuitest.pro index 3d071aa..b9f94bc 100644 --- a/plugins/styles/qtuitest/qtuitest.pro +++ b/plugins/styles/qtuitest/qtuitest.pro @@ -11,10 +11,10 @@ DEPENDPATH+=$$SRCROOT include($$SRCROOT/libqtuitest/libqtuitest.pri) +target.path=$$[QT_INSTALL_PLUGINS]/styles unix:!symbian { MOC_DIR=$$OUT_PWD/.moc OBJECTS_DIR=$$OUT_PWD/.obj - target.path=$$[QT_INSTALL_PLUGINS]/styles INSTALLS+=target !mac { LIBS+=-L$$BUILDROOT/lib -lqtslave @@ -32,18 +32,11 @@ symbian { mac { CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqtslave_debug CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtslave - target.path=$$[QT_INSTALL_PLUGINS]/styles - INSTALLS+=target } win32 { CONFIG(debug,debug|release): LIBS+= -L$$BUILDROOT/libqtslave/debug -lqtslaved CONFIG(release,debug|release):LIBS+= -L$$BUILDROOT/libqtslave/release -lqtslave - target.path=$$[QT_INSTALL_PLUGINS]/styles - INSTALLS+=target } -maemo5|maemo6 { - target.path = /usr/local/lib - INSTALLS += target -} +INSTALLS += target diff --git a/qtuitest.pro b/qtuitest.pro new file mode 100644 index 0000000..329911b --- /dev/null +++ b/qtuitest.pro @@ -0,0 +1,35 @@ +TEMPLATE=subdirs +SUBDIRS+=libqtuitest libqtslave plugins qtbindings botan coreplugin libqsystemtest interpreter tests +CONFIG += ordered + +INCLUDEPATH += $$PWD +INCLUDEPATH += $$PWD/botan/build + +system(echo QMAKEFEATURES+=$$PWD/features >> $$OUT_PWD/.qmake.cache) + +unix:!mac:!symbian { + system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi) + system(echo SRCROOT=$(readlink -f $$PWD) >> $$OUT_PWD/.qmake.cache) + system(echo BUILDROOT=$(readlink -f $$OUT_PWD) >> $$OUT_PWD/.qmake.cache) +} + +mac { + system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi) + system(echo SRCROOT='$$PWD' >> $$OUT_PWD/.qmake.cache) + system(echo BUILDROOT='$$OUT_PWD' >> $$OUT_PWD/.qmake.cache) +} + +symbian { + SUBDIRS-=qtbindings libqsystemtest interpreter + system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache) + system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache) +} + +win32 { + WIN_PWD=$$replace(PWD,/,\) + WIN_OUT_PWD=$$replace(OUT_PWD,/,\) + system(xcopy $$WIN_PWD\features $$WIN_OUT_PWD\features /E /I /D /Y) + system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache) + system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache) + system(echo INSTALLROOT=$$OUT_PWD/bin >> $$OUT_PWD/.qmake.cache) +} diff --git a/qtuitestrunner.pro b/qtuitestrunner.pro index de09172..d81a264 100644 --- a/qtuitestrunner.pro +++ b/qtuitestrunner.pro @@ -18,13 +18,11 @@ BOTAN_SRC=$$QTUITEST_SRC/botan/src include($$BOTAN_SRC/botan.pri) HEADERS +=\ -# $$QTUITEST_SRC/libqsystemtest/gracefulquit.h\ $$QTUITEST_SRC/libqtuitest/qtestprotocol_p.h\ $$QTUITEST_SRC/libqtuitest/qtuitestelapsedtimer_p.h SOURCES +=\ -# $$QTUITEST_SRC/libqsystemtest/gracefulquit.cpp\ $$QTUITEST_SRC/libqtuitest/qtestprotocol.cpp\ $$QTUITEST_SRC/libqtuitest/qtuitestelapsedtimer.cpp\ $$QTUITEST_SRC/interpreter/main.cpp |