aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmldebugservice
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/debugger/qqmldebugservice')
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/data/test.qml60
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro5
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp40
3 files changed, 104 insertions, 1 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugservice/data/test.qml b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
new file mode 100644
index 0000000000..e019ba8b17
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+ function foo() {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
index 57b0019dfa..5879506a58 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -11,6 +11,11 @@ INCLUDEPATH += ../shared
include(../../../shared/util.pri)
include(../shared/debugutil.pri)
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/test.qml
+
DEFINES += QT_QML_DEBUG_NO_WARNING
QT += qml-private testlib gui-private
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index a895f16dc5..dd4dd003ec 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -44,6 +44,7 @@
#include <QHostAddress>
#include <QDebug>
#include <QThread>
+#include <QLibraryInfo>
#include <QtQml/qqmlengine.h>
@@ -55,7 +56,7 @@
#define PORT 3769
#define STR_PORT "3769"
-class tst_QQmlDebugService : public QObject
+class tst_QQmlDebugService : public QQmlDataTest
{
Q_OBJECT
private:
@@ -65,6 +66,7 @@ private:
private slots:
void initTestCase();
+ void checkPortRange();
void name();
void version();
void state();
@@ -78,6 +80,7 @@ private slots:
void tst_QQmlDebugService::initTestCase()
{
+ QQmlDataTest::initTestCase();
const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
new QQmlEngine(this);
@@ -96,6 +99,41 @@ void tst_QQmlDebugService::initTestCase()
QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
}
+void tst_QQmlDebugService::checkPortRange()
+{
+ QQmlDebugConnection *connection1 = new QQmlDebugConnection();
+ QQmlDebugProcess *process1 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+
+ process1->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772, 3774 ") << testFile("test.qml"));
+
+ if (!process1->waitForSessionStart())
+ QFAIL("could not launch application, or did not get 'Waiting for connection'.");
+
+ const int port1 = process1->debugPort();
+ connection1->connectToHost("127.0.0.1", port1);
+ if (!connection1->waitForConnected())
+ QFAIL("could not connect to host!");
+
+ // Second instance
+ QQmlDebugConnection *connection2 = new QQmlDebugConnection();
+ QQmlDebugProcess *process2 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+
+ process2->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772,3774") << testFile("test.qml"));
+
+ if (!process2->waitForSessionStart())
+ QFAIL("could not launch application, or did not get 'Waiting for connection'.");
+
+ const int port2 = process2->debugPort();
+ connection2->connectToHost("127.0.0.1", port2);
+ if (!connection2->waitForConnected())
+ QFAIL("could not connect to host!");
+
+ delete connection1;
+ delete process1;
+ delete connection2;
+ delete process2;
+}
+
void tst_QQmlDebugService::name()
{
QString name = "tst_QQmlDebugService::name()";