aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@rim.com>2012-12-21 15:42:47 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-17 03:04:56 +0200
commit9aec6efd1f7e0c4922253163efc2e7ea7e751f0f (patch)
tree0dd84012338b6b8c4c2db235b7f06b6f7b568de1 /tests
parentf94c14821b5a4bede0ad1a5e41cb355880f87f97 (diff)
Add qml tool
This tool simply runs QML files using a QQmlApplicationEngine. It is configurable so as to behave, by default, like qmlscene in that it will automatically place non-Window QtQuick 2 Items inside a QQuickWindow with the size of the root item. The configuration is extensible so that other GUI scenes can also use it by altering the configuration files in their installation. On OS X, it is an app bundle, and handles the QFileOpenEvent so that it can be the tool with which qml files are usually launched by double-clicking. (This does not break the ability to use it on the command line too: the options still work, you just have to give the path to the executable inside the bundle.) Change-Id: I6bac813ce188be54842a78d7b532fcf2d54dc443 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp7
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp3
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp16
7 files changed, 32 insertions, 11 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index e6cbd41b8e..9318372e2c 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -48,6 +48,7 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
+const char *ENABLE_DEBUG= "-enable-debugger";
const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block";
const char *QMLFILE = "test.qml";
@@ -179,10 +180,10 @@ void tst_QDebugMessageService::cleanupTestCase()
void tst_QDebugMessageService::init()
{
m_connection = new QQmlDebugConnection();
- m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+ m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml", this);
m_client = new QQmlDebugMsgClient(m_connection);
- m_process->start(QStringList() << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE));
+ m_process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index e5a7af630a..9bf2d8849e 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -129,6 +129,7 @@ const char *UNCAUGHT = "uncaught";
//const char *PAUSE = "pause";
//const char *RESUME = "resume";
+const char *ENABLE_DEBUG= "-enable-debugger";//flag needed for debugger with qml binary
const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
const char *TEST_QMLFILE = "test.qml";
@@ -1009,13 +1010,13 @@ void tst_QQmlDebugJS::cleanupTestCase()
bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
{
connection = new QQmlDebugConnection();
- process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+ process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml", this);
client = new QJSDebugClient(connection);
if (blockMode)
- process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
+ process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(BLOCKMODE) << testFile(qmlFile));
else
- process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
+ process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(NORMALMODE) << testFile(qmlFile));
if (!process->waitForSessionStart()) {
qDebug() << "could not launch application, or did not get 'Waiting for connection'.";
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 5badcaa3ae..231e37c6fb 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -107,9 +107,10 @@ void tst_QQmlEngineDebugInspectorIntegration::init()
{
const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ // ### Still using qmlscene because of QTBUG-33376
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ "/qmlscene", this);
- m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
+ m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml"));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index e430875355..2eeb4ce5b2 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -89,8 +89,9 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
{
const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ // ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase)
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
- m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
+ m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml"));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
@@ -179,7 +180,7 @@ void tst_QQmlInspector::reloadQmlWindow()
m_client->reloadQml(changesHash);
QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
- QEXPECT_FAIL("", "cannot debug with a QML file containing a top-level Window", Abort);
+ QEXPECT_FAIL("", "cannot debug with a QML file containing a top-level Window", Abort); // QTBUG-33376
QTRY_COMPARE(m_process->output().contains(
QString("version 2.0")), true);
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index e4f886f7ce..4cf8fa64c5 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -198,8 +198,6 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
stream >> data.time >> data.messageType;
- QVERIFY(data.time >= -1);
-
switch (data.messageType) {
case (QQmlProfilerClient::Event): {
stream >> data.detailType;
@@ -299,8 +297,10 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
{
+ // ### Still using qmlscene due to QTBUG-33377
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
+ arguments << QLatin1String("-enable-debugger");
if (block)
arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index f33ee55c46..f0485fb68a 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -204,8 +204,9 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message)
bool tst_QV8ProfilerService::connect(bool block, const QString &testFile,
QString *error)
{
- const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
+ const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml";
QStringList arguments;
+ arguments << QLatin1String("-enable-debugger");
if (block)
arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index ab27337d41..99647cda11 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -43,6 +43,8 @@
#include <QEventLoop>
#include <QTimer>
+#include <QFileInfo>
+#include <QDir>
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
@@ -123,6 +125,17 @@ QString QQmlDebugProcess::state()
void QQmlDebugProcess::start(const QStringList &arguments)
{
+#ifdef Q_OS_MAC
+ // make sure m_executable points to the actual binary even if it's inside an app bundle
+ QFileInfo binFile(m_executable);
+ if (!binFile.isExecutable()) {
+ QDir bundleDir(m_executable + ".app");
+ if (bundleDir.exists()) {
+ m_executable = bundleDir.absoluteFilePath("Contents/MacOS/" + binFile.baseName());
+ //qDebug() << Q_FUNC_INFO << "found bundled binary" << m_executable;
+ }
+ }
+#endif
m_mutex.lock();
m_port = 0;
m_process.setEnvironment(m_environment);
@@ -220,6 +233,9 @@ void QQmlDebugProcess::processAppOutput()
m_eventLoop.quit();
continue;
}
+ } else if (line.startsWith("qml:")) {
+ // ### Can't enable quiet mode because that also suppresses application output
+ continue; //We don't use these, but they aren't output from the app either
} else {
// set to true if there is output not coming from the debugger
outputFromAppItself = true;