summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Baak <ed.baak@nokia.com>2010-07-23 09:53:30 +1000
committerEd Baak <ed.baak@nokia.com>2010-07-23 09:53:30 +1000
commit1931f3cd66378759593f14a4ce5c5bee864733ed (patch)
tree7d049584044babfdf31bc5554adbac4e8465b012
parentdecbc60035f65acaa1c225ea9a7ba4fb8634f0b9 (diff)
parent0c3794fdee0ab25fa365664a9e64ab14297cd92d (diff)
Merge branch 'master' of scm.dev.nokia.troll.no:research/qtuitest
Conflicts: libqsystemtest/qsystemtest.h libqtslave/qtestslave.cpp
-rw-r--r--libqsystemtest/qsystemtest.cpp93
-rw-r--r--libqsystemtest/qsystemtest.h8
-rw-r--r--libqsystemtest/qsystemtest_p.cpp11
-rw-r--r--libqtslave/libqtslave.pro4
-rw-r--r--libqtslave/qtestslave.cpp23
-rw-r--r--tests/qtuitest/sys_assistant/sys_assistant.pro2
-rw-r--r--tests/qtuitest/sys_assistant/sys_assistant.qtt (renamed from tests/qtuitest/sys_assistant/sys_assistant.js)0
-rw-r--r--tests/qtuitest/sys_designer/sys_designer.pro2
-rw-r--r--tests/qtuitest/sys_designer/sys_designer.qtt (renamed from tests/qtuitest/sys_designer/sys_designer.js)0
-rw-r--r--tests/qtuitest/sys_graphicsView/sys_graphicsView.pro2
-rw-r--r--tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt (renamed from tests/qtuitest/sys_graphicsView/sys_graphicsView.js)0
-rw-r--r--tests/qtuitest/sys_linguist/sys_linguist.pro2
-rw-r--r--tests/qtuitest/sys_linguist/sys_linguist.qtt (renamed from tests/qtuitest/sys_linguist/sys_linguist.js)4
-rw-r--r--tests/shared/filedialog.qtt (renamed from tests/shared/filedialog.js)0
14 files changed, 138 insertions, 13 deletions
diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp
index ab164b2..0dde6dd 100644
--- a/libqsystemtest/qsystemtest.cpp
+++ b/libqsystemtest/qsystemtest.cpp
@@ -729,7 +729,7 @@ QString QSystemTest::getenv(QString const& key)
/*!
Returns true if the test system is running the operating system specified by \a os.
- The supported values are: UNIX, LINUX, MAC, WIN32, WINCE and SYMBIAN.
+ The supported values are: UNIX, LINUX, MAEMO, MAC, WIN32, WINCE and SYMBIAN.
*/
bool QSystemTest::checkOS(QString const& os)
{
@@ -751,6 +751,52 @@ bool QSystemTest::checkOS(QString const& os)
}
/*!
+ Returns the target identifier is used when needing to uniquely identifying
+ the target.
+ Default value for target identifier is \bold default unless set changed by
+ \list
+ \o the -targetID option to qtuitestrunner
+ \o the value of $QTUITEST_TARGETID environment variable when qtuitestrunner is launched
+ \o the value set using the function setTargetIdentifier() in the test script
+ \endlist
+
+ /sa setTargetIdentifier()
+ */
+QString QSystemTest::targetIdentifier()
+{
+ if (m_run_as_manual_test)
+ return QString();
+
+ QTestMessage message("targetIdentifier");
+
+ QTestMessage reply;
+ if (!queryPassed( "OK", "", BT(message), "", &reply )) return QString();
+ if (!reply["targetIdentifier"].isValid()) {
+ fail("No data in reply to targetIdentifier");
+ return QString();
+ }
+ return reply["targetIdentifier"].toString();
+}
+
+/*!
+ Sets the target identifier is used when needing to uniquely identifying
+ the target.
+
+ /sa targetIdentifier()
+ */
+void QSystemTest::setTargetIdentifier(const QString &id)
+{
+ if (m_run_as_manual_test)
+ return;
+
+ QTestMessage reply;
+ QTestMessage message("setTargetIdentifier");
+ message["targetIdentifier"] = id;
+
+ queryPassed( "OK", "", BT(message), "", &reply);
+}
+
+/*!
\internal
Grabs a snapshot of the widget specified by \a {queryPath}, optionally excluding \a maskedWidgets from the snapshot. Each masked widget is replaced by a black rectangle, and any overlapping widgets will also be concealed.
@@ -2278,6 +2324,11 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
args << QString("-style=qtuitest");
#endif
+ // setup configuration for target, used by configTarget() later
+ QByteArray defTargetID = qgetenv("QTUITEST_TARGETID");
+ if (!defTargetID.isEmpty())
+ m_targetID = QString(defTargetID);
+
QByteArray defArgs = qgetenv("QTUITEST_DEFAULT_AUT_ARGS");
if (defArgs.length()) {
QList<QByteArray> defaultArgs = defArgs.split(' ');
@@ -2306,8 +2357,8 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
delete proc;
return;
}
-
m_aut << QPointer<QProcess>(proc);
+ configTarget();
} else {
// Running on device
@@ -2335,6 +2386,11 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
}
}
+ // setup configuration for target, used by configTarget() later
+ QByteArray defTargetID = qgetenv("QTUITEST_TARGETID");
+ if (!defTargetID.isEmpty())
+ m_targetID = QString(defTargetID);
+
args.prepend(app);
static QByteArray startProcess = qgetenv("QTUITEST_START_PROCESS");
if (startProcess.isEmpty()) {
@@ -2350,6 +2406,7 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
fail(QString("Could not connect to remote process '%1'.").arg(app));
}
m_remote_aut << app;
+ configTarget();
}
}
@@ -2775,7 +2832,17 @@ void QSystemTest::processCommandLine( int &argc, char *argv[] )
argv[i+1] = 0;
++offset;
++i;
+ } else if ( !strcasecmp(argv[i], "-targetID") ) {
+ argv[i] = 0;
+ offset++;
+
+ if ( i+1 >= argc || !strlen(argv[i+1]) )
+ qFatal("Expected a string after -targetID");
+ m_targetID = QString::fromLocal8Bit(argv[i+1]);
+ argv[i+1] = 0;
+ ++offset;
+ ++i;
} else if ( !strcasecmp(argv[i], "-demomode") ) {
argv[i] = 0;
offset++;
@@ -2942,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);
@@ -3012,6 +3086,7 @@ void QSystemTest::printUsage(int argc, char *argv[]) const
" -env VAR=VALUE : Specify additional environment variables to be applied to tested \n"
" applications. For example, pass -env DISPLAY=:123 to run tested \n"
" applications on a different X server.\n"
+ " -targetID : Specify the target identifier for system under test, defaults to \'default\' or $QTUITEST_TARGETID if set\n"
, DEFAULT_AUT_PORT
);
}
@@ -3619,6 +3694,20 @@ QTestRemote *QSystemTest::testIDE()
return &m_qtest_ide;
}
+/*!
+ \internal
+ Pass any configuration values to the system under test
+ */
+void QSystemTest::configTarget()
+{
+ if (m_run_as_manual_test)
+ return;
+
+ // set the target identifier
+ if (!m_targetID.isEmpty())
+ setTargetIdentifier(m_targetID);
+}
+
/*! \typedef StringArray
\relates QSystemTest
diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h
index dedc6b2..edb1455 100644
--- a/libqsystemtest/qsystemtest.h
+++ b/libqsystemtest/qsystemtest.h
@@ -327,6 +327,8 @@ public slots:
QString runProcess(const QString&,const QStringList&,const QString&);
QString getenv(const QString&);
bool checkOS(const QString&);
+ QString targetIdentifier();
+ void setTargetIdentifier(const QString &);
void putFile(const QString&,const QString&,QFile::Permissions=0);
void putData(const QByteArray&,const QString&,QFile::Permissions=0);
void getFile(const QString&,const QString&);
@@ -404,6 +406,8 @@ protected:
bool isConnected() const;
bool demoMode() const;
QString autHost() const;
+ void configTarget();
+
int autPort() const;
virtual QString currentFile();
@@ -521,7 +525,7 @@ private:
QString m_manual_commands;
QStringList m_manual_command_data;
QStringList alternative_command_data;
- void showPromptDialog();
+ void showPromptDialog(const QString& = QString());
bool isConnected();
// the following parameters are used to start an Application_Under_Test
@@ -533,6 +537,8 @@ private:
bool m_demo_mode;
bool m_verbose_perf;
bool m_verbose;
+ QStringList m_env;
+ QString m_targetID;
QTestRemote m_qtest_ide;
QMap<QString, QString> appNameToBinary;
bool m_strict_mode;
diff --git a/libqsystemtest/qsystemtest_p.cpp b/libqsystemtest/qsystemtest_p.cpp
index 1cfccc2..82e684f 100644
--- a/libqsystemtest/qsystemtest_p.cpp
+++ b/libqsystemtest/qsystemtest_p.cpp
@@ -821,10 +821,15 @@ QStringList QSystemTest::processEnvironment( QStringList const& in ) const
return out;
}
-void QSystemTest::showPromptDialog()
+void QSystemTest::showPromptDialog( const QString &text )
{
- QString promptText = m_manual_commands;
- m_manual_commands.clear();
+ QString promptText;
+ if (text.isNull()) {
+ promptText = m_manual_commands;
+ m_manual_commands.clear();
+ } else {
+ promptText = text;
+ }
if (promptText.isEmpty()) {
recordEvents( "" );
diff --git a/libqtslave/libqtslave.pro b/libqtslave/libqtslave.pro
index b8b1c47..d06cdb2 100644
--- a/libqtslave/libqtslave.pro
+++ b/libqtslave/libqtslave.pro
@@ -16,6 +16,10 @@ TARGET=qtslave
TARGET=$$qtLibraryTarget($$TARGET)
QT+=network
DEFINES+=QTSLAVE_TARGET
+# we need to set a MAEMO define since this is not yet in Qt
+maemo*{
+ DEFINES+=Q_OS_MAEMO
+}
unix:!symbian {
MOC_DIR=$$OUT_PWD/.moc
diff --git a/libqtslave/qtestslave.cpp b/libqtslave/qtestslave.cpp
index 2a41936..a4ac20a 100644
--- a/libqtslave/qtestslave.cpp
+++ b/libqtslave/qtestslave.cpp
@@ -107,7 +107,8 @@ public:
QTestSlavePrivate(QTestSlave *parent)
: eventRecordingEnabled(false),
p(parent),
- recorder(this)
+ recorder(this),
+ targetId(QLatin1String("default"))
{
// Play a sound as a audible confirmation that an app is started with QtUITest plugin loaded
QString fname = QDir::homePath() + QDir::separator() + "qtuitest.wav";
@@ -125,6 +126,7 @@ public:
QTestSlave *p;
QTime lastFocusWarn;
QtUiTestRecorder recorder;
+ QVariant targetId;
public slots:
void record_entered(QObject*, QVariant const&);
@@ -212,6 +214,8 @@ public slots:
QTestMessage getLocale (QTestMessage const&);
QTestMessage getenv (QTestMessage const&);
QTestMessage checkOS (QTestMessage const&);
+ QTestMessage targetIdentifier (QTestMessage const&);
+ QTestMessage setTargetIdentifier(QTestMessage const&);
void sendBecameIdleMessage();
@@ -1681,6 +1685,9 @@ QTestMessage QTestSlavePrivate::checkOS( QTestMessage const &message )
#ifdef Q_OS_LINUX
if (os == "LINUX") result = true;
#endif
+#ifdef Q_OS_MAEMO
+ if (os == "MAEMO") result = true;
+#endif
#ifdef Q_OS_MAC
if (os == "MAC") result = true;
#endif
@@ -1698,6 +1705,20 @@ QTestMessage QTestSlavePrivate::checkOS( QTestMessage const &message )
return RET(reply, "OK");
}
+QTestMessage QTestSlavePrivate::targetIdentifier(QTestMessage const&message)
+{
+ QTestMessage reply;
+ reply["targetIdentifier"] = targetId;
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setTargetIdentifier(QTestMessage const&message)
+{
+ QTestMessage reply;
+ targetId = message["targetIdentifier"];
+ return RET(reply, "OK");
+}
+
bool QTestSlavePrivate::event(QEvent *e)
{
if ((int)IdleEvent::Type != (int)e->type()) return false;
diff --git a/tests/qtuitest/sys_assistant/sys_assistant.pro b/tests/qtuitest/sys_assistant/sys_assistant.pro
index e57de58..a057ba3 100644
--- a/tests/qtuitest/sys_assistant/sys_assistant.pro
+++ b/tests/qtuitest/sys_assistant/sys_assistant.pro
@@ -1,4 +1,4 @@
-SOURCES=sys_assistant.js
+SOURCES=sys_assistant.qtt
CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_assistant/sys_assistant.js b/tests/qtuitest/sys_assistant/sys_assistant.qtt
index f2449d4..f2449d4 100644
--- a/tests/qtuitest/sys_assistant/sys_assistant.js
+++ b/tests/qtuitest/sys_assistant/sys_assistant.qtt
diff --git a/tests/qtuitest/sys_designer/sys_designer.pro b/tests/qtuitest/sys_designer/sys_designer.pro
index 11e35e1..2fa97f5 100644
--- a/tests/qtuitest/sys_designer/sys_designer.pro
+++ b/tests/qtuitest/sys_designer/sys_designer.pro
@@ -1,4 +1,4 @@
-SOURCES=sys_designer.js
+SOURCES=sys_designer.qtt
CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_designer/sys_designer.js b/tests/qtuitest/sys_designer/sys_designer.qtt
index 7defc99..7defc99 100644
--- a/tests/qtuitest/sys_designer/sys_designer.js
+++ b/tests/qtuitest/sys_designer/sys_designer.qtt
diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro
index 60f9afe..a74cb42 100644
--- a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro
+++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro
@@ -1,4 +1,4 @@
-SOURCES=sys_graphicsView.js
+SOURCES=sys_graphicsView.qtt
TESTAPPS=graphicsViewTest
CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.js b/tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt
index 9e23617..9e23617 100644
--- a/tests/qtuitest/sys_graphicsView/sys_graphicsView.js
+++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt
diff --git a/tests/qtuitest/sys_linguist/sys_linguist.pro b/tests/qtuitest/sys_linguist/sys_linguist.pro
index 9edffdd..0f2a803 100644
--- a/tests/qtuitest/sys_linguist/sys_linguist.pro
+++ b/tests/qtuitest/sys_linguist/sys_linguist.pro
@@ -1,4 +1,4 @@
-SOURCES=sys_linguist.js
+SOURCES=sys_linguist.qtt
CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_linguist/sys_linguist.js b/tests/qtuitest/sys_linguist/sys_linguist.qtt
index da1aa41..a098cc5 100644
--- a/tests/qtuitest/sys_linguist/sys_linguist.js
+++ b/tests/qtuitest/sys_linguist/sys_linguist.qtt
@@ -41,7 +41,7 @@
-include("filedialog.js");
+include("filedialog.qtt");
testcase = {
@@ -149,4 +149,4 @@ testcase = {
compare(translatedChars, labels[labels.indexOf("Characters (with spaces):")+2]);
}
-} \ No newline at end of file
+}
diff --git a/tests/shared/filedialog.js b/tests/shared/filedialog.qtt
index 0a4f904..0a4f904 100644
--- a/tests/shared/filedialog.js
+++ b/tests/shared/filedialog.qtt