aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/debugger/debugger.pro2
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro7
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro7
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro8
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro (renamed from tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro)9
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp (renamed from tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp)70
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro7
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro10
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro9
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri9
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp410
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h112
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug.cpp1068
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug_p.h388
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp4
-rw-r--r--tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp14
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess2.qml5
-rw-r--r--tests/auto/qml/v4/testtypes.h3
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp31
-rw-r--r--tests/auto/quick/qquickgridview/data/multipleTransitions.qml6
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp39
-rw-r--r--tests/auto/quick/qquicklistview/data/multipleTransitions.qml6
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp35
-rw-r--r--tests/auto/quick/qquickmousearea/data/wheel.qml24
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp21
37 files changed, 2238 insertions, 121 deletions
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index 4f9ebbc350..7669aaa83c 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
PRIVATETESTS += \
- qqmlenginedebug \
+ qqmlenginedebugservice \
qqmldebugclient \
qqmldebugservice \
qqmldebugjs \
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index d62a262d2f..4b5bf60ace 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -3,14 +3,11 @@ TARGET = tst_qdebugmessageservice
QT += network qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-
-SOURCES += tst_qdebugmessageservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qdebugmessageservice.cpp
INCLUDEPATH += ../shared
-
include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index a19fd4b766..8473774ae6 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include <QtQml/private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#include "../../../shared/util.h"
#include <QtCore/QString>
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index 88439196a7..f631929427 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qpacketprotocol
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qpacketprotocol.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qpacketprotocol.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test
QT += qml-private network testlib
diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
index c02dd2d8fa..4a6efb469d 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -48,7 +48,7 @@
#include <private/qpacketprotocol_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
class tst_QPacketProtocol : public QObject
{
diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
index d298b5c087..22a4df7dc9 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
+++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugclient
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugclient.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugclient.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index b18f30ffb3..9377ef6a8f 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -47,7 +47,7 @@
#include <QtQml/qqmlengine.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#define PORT 13770
#define STR_PORT "13770"
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index 7bb5161ed6..7c3a2ea042 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -3,13 +3,11 @@ TARGET = tst_qqmldebugjs
QT += qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugjs.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugjs.cpp
INCLUDEPATH += ../shared
-
-include (../../../shared/util.pri)
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9a8b00bb6c..9cd021d5e9 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -46,11 +46,11 @@
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QtCore/QLibraryInfo>
-#include <QtQml/private/qqmldebugclient_p.h>
#include <QtQml/QJSEngine>
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
const char *V8REQUEST = "v8request";
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
index ecb3b2ca2c..dc2039615a 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugservice.cpp
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 3699530e00..a7fc284443 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -47,11 +47,11 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
#include <private/qqmldebugservice_p.h>
#include "../../../shared/util.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#define PORT 13769
#define STR_PORT "13769"
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index 529c4667cf..0b92a726b5 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -1,10 +1,11 @@
CONFIG += testcase
-TARGET = tst_qqmlenginedebug
+TARGET = tst_qqmlenginedebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlenginedebug.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlenginedebugservice.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index df8109abfb..a35aafff4d 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -54,16 +54,16 @@
#include <private/qqmlbinding_p.h>
#include <private/qqmlboundsignal_p.h>
-#include <private/qqmlenginedebug_p.h>
#include <private/qqmldebugservice_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlproperty_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmlenginedebug_p.h"
Q_DECLARE_METATYPE(QQmlDebugWatch::State)
-class tst_QQmlEngineDebug : public QObject
+class tst_QQmlEngineDebugService : public QObject
{
Q_OBJECT
@@ -127,7 +127,7 @@ signals:
QML_DECLARE_TYPE(NonScriptProperty)
-QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool recursive)
+QQmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(int context, bool recursive)
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -153,7 +153,7 @@ QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool r
return result;
}
-QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
+QQmlDebugPropertyReference tst_QQmlEngineDebugService::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
{
foreach(const QQmlDebugPropertyReference &p, props) {
if (p.name() == name)
@@ -162,7 +162,7 @@ QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDeb
return QQmlDebugPropertyReference();
}
-void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
+void tst_QQmlEngineDebugService::waitForQuery(QQmlDebugQuery *query)
{
QVERIFY(query);
QCOMPARE(query->parent(), qobject_cast<QObject*>(this));
@@ -171,7 +171,7 @@ void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
QFAIL("query timed out");
}
-void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
+void tst_QQmlEngineDebugService::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
{
const QMetaObject *meta = o->metaObject();
@@ -248,7 +248,7 @@ void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectR
}
}
-void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.className(), b.className());
@@ -272,7 +272,7 @@ void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference
recursiveCompareObjects(a.children()[i], b.children()[i]);
}
-void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.name(), b.name());
@@ -286,7 +286,7 @@ void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReferen
recursiveCompareContexts(a.contexts()[i], b.contexts()[i]);
}
-void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
+void tst_QQmlEngineDebugService::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
{
QCOMPARE(a.objectDebugId(), b.objectDebugId());
QCOMPARE(a.name(), b.name());
@@ -296,7 +296,7 @@ void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a,
QCOMPARE(a.hasNotifySignal(), b.hasNotifySignal());
}
-void tst_QQmlEngineDebug::initTestCase()
+void tst_QQmlEngineDebugService::initTestCase()
{
qRegisterMetaType<QQmlDebugWatch::State>();
qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
@@ -394,7 +394,7 @@ void tst_QQmlEngineDebug::initTestCase()
QTRY_VERIFY(m_dbg->state() == QQmlEngineDebug::Enabled);
}
-void tst_QQmlEngineDebug::cleanupTestCase()
+void tst_QQmlEngineDebugService::cleanupTestCase()
{
delete m_dbg;
delete m_conn;
@@ -402,7 +402,7 @@ void tst_QQmlEngineDebug::cleanupTestCase()
delete m_engine;
}
-void tst_QQmlEngineDebug::setMethodBody()
+void tst_QQmlEngineDebugService::setMethodBody()
{
QQmlDebugObjectReference obj = findRootObject(2);
@@ -439,7 +439,7 @@ void tst_QQmlEngineDebug::setMethodBody()
}
}
-void tst_QQmlEngineDebug::watch_property()
+void tst_QQmlEngineDebugService::watch_property()
{
QQmlDebugObjectReference obj = findRootObject();
QQmlDebugPropertyReference prop = findProperty(obj.properties(), "width");
@@ -484,7 +484,7 @@ void tst_QQmlEngineDebug::watch_property()
QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2));
}
-void tst_QQmlEngineDebug::watch_object()
+void tst_QQmlEngineDebugService::watch_object()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -557,7 +557,7 @@ void tst_QQmlEngineDebug::watch_object()
QCOMPARE(newHeight, origHeight * 2);
}
-void tst_QQmlEngineDebug::watch_expression()
+void tst_QQmlEngineDebugService::watch_expression()
{
QFETCH(QString, expr);
QFETCH(int, increment);
@@ -620,7 +620,7 @@ void tst_QQmlEngineDebug::watch_expression()
}
}
-void tst_QQmlEngineDebug::watch_expression_data()
+void tst_QQmlEngineDebugService::watch_expression_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<int>("increment");
@@ -630,21 +630,21 @@ void tst_QQmlEngineDebug::watch_expression_data()
QTest::newRow("width+10") << "width + 10" << 10 << 5;
}
-void tst_QQmlEngineDebug::watch_context()
+void tst_QQmlEngineDebugService::watch_context()
{
QQmlDebugContextReference c;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(c, QString(), this));
}
-void tst_QQmlEngineDebug::watch_file()
+void tst_QQmlEngineDebugService::watch_file()
{
QQmlDebugFileReference f;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(f, this));
}
-void tst_QQmlEngineDebug::queryAvailableEngines()
+void tst_QQmlEngineDebugService::queryAvailableEngines()
{
QQmlDebugEnginesQuery *q_engines;
@@ -679,7 +679,7 @@ void tst_QQmlEngineDebug::queryAvailableEngines()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryRootContexts()
+void tst_QQmlEngineDebugService::queryRootContexts()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -725,7 +725,7 @@ void tst_QQmlEngineDebug::queryRootContexts()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryObject()
+void tst_QQmlEngineDebugService::queryObject()
{
QFETCH(bool, recursive);
@@ -797,7 +797,7 @@ void tst_QQmlEngineDebug::queryObject()
}
}
-void tst_QQmlEngineDebug::queryObject_data()
+void tst_QQmlEngineDebugService::queryObject_data()
{
QTest::addColumn<bool>("recursive");
@@ -805,7 +805,7 @@ void tst_QQmlEngineDebug::queryObject_data()
QTest::newRow("recursive") << true;
}
-void tst_QQmlEngineDebug::queryExpressionResult()
+void tst_QQmlEngineDebugService::queryExpressionResult()
{
QFETCH(QString, expr);
QFETCH(QVariant, result);
@@ -846,7 +846,7 @@ void tst_QQmlEngineDebug::queryExpressionResult()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryExpressionResult_data()
+void tst_QQmlEngineDebugService::queryExpressionResult_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<QVariant>("result");
@@ -861,7 +861,7 @@ void tst_QQmlEngineDebug::queryExpressionResult_data()
QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugFileReference()
{
QQmlDebugFileReference ref;
QVERIFY(ref.url().isEmpty());
@@ -885,7 +885,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugEngineReference()
{
QQmlDebugEngineReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -909,7 +909,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugObjectReference()
{
QQmlDebugObjectReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -942,7 +942,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
recursiveCompareObjects(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugContextReference()
{
QQmlDebugContextReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -967,7 +967,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
recursiveCompareContexts(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugPropertyReference()
{
QQmlDebugObjectReference rootObject = findRootObject();
QQmlDebugObjectQuery *query = m_dbg->queryObject(rootObject, this);
@@ -990,7 +990,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
compareProperties(r, ref);
}
-void tst_QQmlEngineDebug::setBindingForObject()
+void tst_QQmlEngineDebugService::setBindingForObject()
{
QQmlDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId() != -1);
@@ -1061,7 +1061,7 @@ void tst_QQmlEngineDebug::setBindingForObject()
QCOMPARE(onEnteredRef.value(), QVariant("{console.log('hello, world') }"));
}
-void tst_QQmlEngineDebug::setBindingInStates()
+void tst_QQmlEngineDebugService::setBindingInStates()
{
// Check if changing bindings of propertychanges works
@@ -1153,7 +1153,7 @@ void tst_QQmlEngineDebug::setBindingInStates()
QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 300);
}
-void tst_QQmlEngineDebug::queryObjectTree()
+void tst_QQmlEngineDebugService::queryObjectTree()
{
const int sourceIndex = 3;
@@ -1227,9 +1227,9 @@ int main(int argc, char *argv[])
_argv[_argc - 1] = arg;
QGuiApplication app(_argc, _argv);
- tst_QQmlEngineDebug tc;
+ tst_QQmlEngineDebugService tc;
return QTest::qExec(&tc, _argc, _argv);
delete _argv;
}
-#include "tst_qqmlenginedebug.moc"
+#include "tst_qqmlenginedebugservice.moc"
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
index 010e97cef7..c24accac1a 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmlinspector
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlinspector.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlinspector.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\"
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 81fe3d5943..2bf43c92a2 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -2,13 +2,13 @@ CONFIG += testcase
TARGET = tst_qqmlprofilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qqmlprofilerservice.cpp
-SOURCES += tst_qqmlprofilerservice.cpp \
- ../shared/debugutil.cpp
-OTHER_FILES += data/test.qml
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
-include (../../../shared/util.pri)
+OTHER_FILES += data/test.qml
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index edc120ba85..2b33ab3944 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qqmlprofilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13773
diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
index e980d6594d..a8dd634855 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
+++ b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
@@ -2,12 +2,11 @@ CONFIG += testcase
TARGET = tst_qv8profilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qv8profilerservice.cpp
-SOURCES += tst_qv8profilerservice.cpp \
- ../shared/debugutil.cpp
-
-include (../../../shared/util.pri)
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
OTHER_FILES += data/test.qml
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index c5992a4403..7b9cda937c 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qv8profilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13774
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index a3d3dce644..3d2f460456 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -44,9 +44,6 @@
#include <QEventLoop>
#include <QTimer>
-#include <private/qqmldebugclient_p.h>
-#include <private/qqmldebugservice_p.h>
-
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
new file mode 100644
index 0000000000..b74f6b08b0
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -0,0 +1,9 @@
+QT += core-private
+
+HEADERS += $$PWD/debugutil_p.h \
+ $$PWD/qqmldebugclient.h \
+ $$PWD/qqmlenginedebug_p.h
+SOURCES += $$PWD/debugutil.cpp \
+ $$PWD/qqmldebugclient.cpp \
+ $$PWD/qqmlenginedebug.cpp
+
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 194f8fa14c..177c712833 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -51,7 +51,7 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
#include <private/qqmldebugservice_p.h>
class QQmlDebugTest
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
new file mode 100644
index 0000000000..0453f88350
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -0,0 +1,410 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugclient.h"
+
+#include <private/qpacketprotocol_p.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+#include <QtNetwork/qnetworkproxy.h>
+
+const int protocolVersion = 1;
+const QString serverId = QLatin1String("QDeclarativeDebugServer");
+const QString clientId = QLatin1String("QDeclarativeDebugClient");
+
+class QQmlDebugClientPrivate
+{
+public:
+ QQmlDebugClientPrivate();
+
+ QString name;
+ QQmlDebugConnection *connection;
+};
+
+class QQmlDebugConnectionPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugConnectionPrivate(QQmlDebugConnection *c);
+ QQmlDebugConnection *q;
+ QPacketProtocol *protocol;
+ QIODevice *device;
+
+ bool gotHello;
+ QHash <QString, float> serverPlugins;
+ QHash<QString, QQmlDebugClient *> plugins;
+
+ void advertisePlugins();
+ void connectDeviceSignals();
+
+public Q_SLOTS:
+ void connected();
+ void readyRead();
+ void deviceAboutToClose();
+};
+
+QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c)
+ : QObject(c), q(c), protocol(0), device(0), gotHello(false)
+{
+ protocol = new QPacketProtocol(q, this);
+ QObject::connect(c, SIGNAL(connected()), this, SLOT(connected()));
+ QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
+
+void QQmlDebugConnectionPrivate::advertisePlugins()
+{
+ if (!q->isConnected())
+ return;
+
+ QPacket pack;
+ pack << serverId << 1 << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::connected()
+{
+ QPacket pack;
+ pack << serverId << 0 << protocolVersion << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::readyRead()
+{
+ if (!gotHello) {
+ QPacket pack = protocol->read();
+ QString name;
+
+ pack >> name;
+
+ bool validHello = false;
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+ if (op == 0) {
+ int version = -1;
+ pack >> version;
+ if (version == protocolVersion) {
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ validHello = true;
+ }
+ }
+ }
+
+ if (!validHello) {
+ qWarning("QQmlDebugConnection: Invalid hello message");
+ QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ return;
+ }
+ gotHello = true;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(iter.key()))
+ newState = QQmlDebugClient::Enabled;
+ iter.value()->stateChanged(newState);
+ }
+ }
+
+ while (protocol->packetsAvailable()) {
+ QPacket pack = protocol->read();
+ QString name;
+ pack >> name;
+
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+
+ if (op == 1) {
+ // Service Discovery
+ QHash<QString, float> oldServerPlugins = serverPlugins;
+ serverPlugins.clear();
+
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ const QString pluginName = iter.key();
+ QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(pluginName))
+ newSate = QQmlDebugClient::Enabled;
+
+ if (oldServerPlugins.contains(pluginName)
+ != serverPlugins.contains(pluginName)) {
+ iter.value()->stateChanged(newSate);
+ }
+ }
+ } else {
+ qWarning() << "QQmlDebugConnection: Unknown control message id" << op;
+ }
+ } else {
+ QByteArray message;
+ pack >> message;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter =
+ plugins.find(name);
+ if (iter == plugins.end()) {
+ qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name;
+ } else {
+ (*iter)->messageReceived(message);
+ }
+ }
+ }
+}
+
+void QQmlDebugConnectionPrivate::deviceAboutToClose()
+{
+ // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close())
+ // without calling the underlying device close fn as that would cause an infinite loop
+ q->QIODevice::close();
+}
+
+QQmlDebugConnection::QQmlDebugConnection(QObject *parent)
+ : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this))
+{
+}
+
+QQmlDebugConnection::~QQmlDebugConnection()
+{
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->d->connection = 0;
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+}
+
+bool QQmlDebugConnection::isConnected() const
+{
+ return state() == QAbstractSocket::ConnectedState;
+}
+
+qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize)
+{
+ return d->device->read(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize)
+{
+ return d->device->write(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::bytesAvailable() const
+{
+ return d->device->bytesAvailable();
+}
+
+bool QQmlDebugConnection::isSequential() const
+{
+ return true;
+}
+
+void QQmlDebugConnection::close()
+{
+ if (isOpen()) {
+ QIODevice::close();
+ d->device->close();
+ emit stateChanged(QAbstractSocket::UnconnectedState);
+
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+ }
+}
+
+bool QQmlDebugConnection::waitForConnected(int msecs)
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->waitForConnected(msecs);
+ return false;
+}
+
+QAbstractSocket::SocketState QQmlDebugConnection::state() const
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->state();
+
+ return QAbstractSocket::UnconnectedState;
+}
+
+void QQmlDebugConnection::flush()
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket) {
+ socket->flush();
+ return;
+ }
+}
+
+void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
+{
+ QTcpSocket *socket = new QTcpSocket(d);
+ socket->setProxy(QNetworkProxy::NoProxy);
+ d->device = socket;
+ d->connectDeviceSignals();
+ d->gotHello = false;
+ connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
+ connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
+ socket->connectToHost(hostName, port);
+ QIODevice::open(ReadWrite | Unbuffered);
+}
+
+void QQmlDebugConnectionPrivate::connectDeviceSignals()
+{
+ connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64)));
+ connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead()));
+ connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose()));
+}
+
+//
+
+QQmlDebugClientPrivate::QQmlDebugClientPrivate()
+ : connection(0)
+{
+}
+
+QQmlDebugClient::QQmlDebugClient(const QString &name,
+ QQmlDebugConnection *parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
+{
+ d->name = name;
+ d->connection = parent;
+
+ if (!d->connection)
+ return;
+
+ if (d->connection->d->plugins.contains(name)) {
+ qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
+ d->connection = 0;
+ } else {
+ d->connection->d->plugins.insert(name, this);
+ d->connection->d->advertisePlugins();
+ }
+}
+
+QQmlDebugClient::~QQmlDebugClient()
+{
+ if (d->connection && d->connection->d) {
+ d->connection->d->plugins.remove(d->name);
+ d->connection->d->advertisePlugins();
+ }
+ delete d;
+}
+
+QString QQmlDebugClient::name() const
+{
+ return d->name;
+}
+
+float QQmlDebugClient::serviceVersion() const
+{
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return d->connection->d->serverPlugins.value(d->name);
+ return -1;
+}
+
+QQmlDebugClient::State QQmlDebugClient::state() const
+{
+ if (!d->connection
+ || !d->connection->isConnected()
+ || !d->connection->d->gotHello)
+ return NotConnected;
+
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return Enabled;
+
+ return Unavailable;
+}
+
+void QQmlDebugClient::sendMessage(const QByteArray &message)
+{
+ if (state() != Enabled)
+ return;
+
+ QPacket pack;
+ pack << d->name << message;
+ d->connection->d->protocol->send(pack);
+ d->connection->flush();
+}
+
+void QQmlDebugClient::stateChanged(State)
+{
+}
+
+void QQmlDebugClient::messageReceived(const QByteArray &)
+{
+}
+
+#include <qqmldebugclient.moc>
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
new file mode 100644
index 0000000000..d3e5cd59a4
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGCLIENT_H
+#define QQMLDEBUGCLIENT_H
+
+#include <QtNetwork/qtcpsocket.h>
+
+#include <private/qtqmlglobal_p.h>
+
+class QQmlDebugConnectionPrivate;
+class Q_QML_PRIVATE_EXPORT QQmlDebugConnection : public QIODevice
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugConnection)
+public:
+ QQmlDebugConnection(QObject * = 0);
+ ~QQmlDebugConnection();
+
+ void connectToHost(const QString &hostName, quint16 port);
+
+ qint64 bytesAvailable() const;
+ bool isConnected() const;
+ QAbstractSocket::SocketState state() const;
+ void flush();
+ bool isSequential() const;
+ void close();
+ bool waitForConnected(int msecs = 30000);
+
+signals:
+ void connected();
+ void stateChanged(QAbstractSocket::SocketState socketState);
+ void error(QAbstractSocket::SocketError socketError);
+
+protected:
+ qint64 readData(char *data, qint64 maxSize);
+ qint64 writeData(const char *data, qint64 maxSize);
+
+private:
+ QQmlDebugConnectionPrivate *d;
+ friend class QQmlDebugClient;
+ friend class QQmlDebugClientPrivate;
+};
+
+class QQmlDebugClientPrivate;
+class Q_QML_PRIVATE_EXPORT QQmlDebugClient : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQmlDebugClient)
+ Q_DISABLE_COPY(QQmlDebugClient)
+
+public:
+ enum State { NotConnected, Unavailable, Enabled };
+
+ QQmlDebugClient(const QString &, QQmlDebugConnection *parent);
+ ~QQmlDebugClient();
+
+ QString name() const;
+ float serviceVersion() const;
+ State state() const;
+
+ virtual void sendMessage(const QByteArray &);
+
+protected:
+ virtual void stateChanged(State);
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QQmlDebugClientPrivate *d;
+ friend class QQmlDebugConnection;
+ friend class QQmlDebugConnectionPrivate;
+};
+
+#endif // QQMLDEBUGCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
new file mode 100644
index 0000000000..8a46c7617c
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
@@ -0,0 +1,1068 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlenginedebug_p.h"
+
+#include "qqmldebugclient.h"
+
+#include <private/qqmlenginedebugservice_p.h>
+
+#include <QtCore/private/qobject_p.h>
+
+class QQmlEngineDebugClient : public QQmlDebugClient
+{
+public:
+ QQmlEngineDebugClient(QQmlDebugConnection *client, QQmlEngineDebugPrivate *p);
+
+protected:
+ virtual void stateChanged(State state);
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QQmlEngineDebugPrivate *priv;
+ friend class QQmlEngineDebugPrivate;
+};
+
+class QQmlEngineDebugPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQmlEngineDebug)
+public:
+ QQmlEngineDebugPrivate(QQmlDebugConnection *);
+ ~QQmlEngineDebugPrivate();
+
+ void stateChanged(QQmlEngineDebug::State status);
+ void message(const QByteArray &);
+
+ QQmlEngineDebugClient *client;
+ int nextId;
+ int getId();
+
+ void decode(QDataStream &, QQmlDebugContextReference &);
+ void decode(QDataStream &, QQmlDebugObjectReference &, bool simple);
+
+ static void remove(QQmlEngineDebug *, QQmlDebugEnginesQuery *);
+ static void remove(QQmlEngineDebug *, QQmlDebugRootContextQuery *);
+ static void remove(QQmlEngineDebug *, QQmlDebugObjectQuery *);
+ static void remove(QQmlEngineDebug *, QQmlDebugExpressionQuery *);
+ static void remove(QQmlEngineDebug *, QQmlDebugWatch *);
+
+ QHash<int, QQmlDebugEnginesQuery *> enginesQuery;
+ QHash<int, QQmlDebugRootContextQuery *> rootContextQuery;
+ QHash<int, QQmlDebugObjectQuery *> objectQuery;
+ QHash<int, QQmlDebugExpressionQuery *> expressionQuery;
+
+ QHash<int, QQmlDebugWatch *> watched;
+};
+
+QQmlEngineDebugClient::QQmlEngineDebugClient(QQmlDebugConnection *client,
+ QQmlEngineDebugPrivate *p)
+ : QQmlDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p)
+{
+}
+
+void QQmlEngineDebugClient::stateChanged(State status)
+{
+ if (priv)
+ priv->stateChanged(static_cast<QQmlEngineDebug::State>(status));
+}
+
+void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
+{
+ if (priv)
+ priv->message(data);
+}
+
+QQmlEngineDebugPrivate::QQmlEngineDebugPrivate(QQmlDebugConnection *c)
+ : client(new QQmlEngineDebugClient(c, this)), nextId(0)
+{
+}
+
+QQmlEngineDebugPrivate::~QQmlEngineDebugPrivate()
+{
+ if (client)
+ client->priv = 0;
+ delete client;
+
+ QHash<int, QQmlDebugEnginesQuery*>::iterator enginesIter = enginesQuery.begin();
+ for (; enginesIter != enginesQuery.end(); ++enginesIter) {
+ enginesIter.value()->m_client = 0;
+ if (enginesIter.value()->state() == QQmlDebugQuery::Waiting)
+ enginesIter.value()->setState(QQmlDebugQuery::Error);
+ }
+
+ QHash<int, QQmlDebugRootContextQuery*>::iterator rootContextIter = rootContextQuery.begin();
+ for (; rootContextIter != rootContextQuery.end(); ++rootContextIter) {
+ rootContextIter.value()->m_client = 0;
+ if (rootContextIter.value()->state() == QQmlDebugQuery::Waiting)
+ rootContextIter.value()->setState(QQmlDebugQuery::Error);
+ }
+
+ QHash<int, QQmlDebugObjectQuery*>::iterator objectIter = objectQuery.begin();
+ for (; objectIter != objectQuery.end(); ++objectIter) {
+ objectIter.value()->m_client = 0;
+ if (objectIter.value()->state() == QQmlDebugQuery::Waiting)
+ objectIter.value()->setState(QQmlDebugQuery::Error);
+ }
+
+ QHash<int, QQmlDebugExpressionQuery*>::iterator exprIter = expressionQuery.begin();
+ for (; exprIter != expressionQuery.end(); ++exprIter) {
+ exprIter.value()->m_client = 0;
+ if (exprIter.value()->state() == QQmlDebugQuery::Waiting)
+ exprIter.value()->setState(QQmlDebugQuery::Error);
+ }
+
+ QHash<int, QQmlDebugWatch*>::iterator watchIter = watched.begin();
+ for (; watchIter != watched.end(); ++watchIter) {
+ watchIter.value()->m_client = 0;
+ watchIter.value()->setState(QQmlDebugWatch::Dead);
+ }
+}
+
+int QQmlEngineDebugPrivate::getId()
+{
+ return nextId++;
+}
+
+void QQmlEngineDebugPrivate::remove(QQmlEngineDebug *c, QQmlDebugEnginesQuery *q)
+{
+ if (c && q) {
+ QQmlEngineDebugPrivate *p = (QQmlEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->enginesQuery.remove(q->m_queryId);
+ }
+}
+
+void QQmlEngineDebugPrivate::remove(QQmlEngineDebug *c,
+ QQmlDebugRootContextQuery *q)
+{
+ if (c && q) {
+ QQmlEngineDebugPrivate *p = (QQmlEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->rootContextQuery.remove(q->m_queryId);
+ }
+}
+
+void QQmlEngineDebugPrivate::remove(QQmlEngineDebug *c, QQmlDebugObjectQuery *q)
+{
+ if (c && q) {
+ QQmlEngineDebugPrivate *p = (QQmlEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->objectQuery.remove(q->m_queryId);
+ }
+}
+
+void QQmlEngineDebugPrivate::remove(QQmlEngineDebug *c, QQmlDebugExpressionQuery *q)
+{
+ if (c && q) {
+ QQmlEngineDebugPrivate *p = (QQmlEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->expressionQuery.remove(q->m_queryId);
+ }
+}
+
+void QQmlEngineDebugPrivate::remove(QQmlEngineDebug *c, QQmlDebugWatch *w)
+{
+ if (c && w) {
+ QQmlEngineDebugPrivate *p = (QQmlEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->watched.remove(w->m_queryId);
+ }
+}
+
+void QQmlEngineDebugPrivate::decode(QDataStream &ds, QQmlDebugObjectReference &o,
+ bool simple)
+{
+ QQmlEngineDebugService::QQmlObjectData data;
+ ds >> data;
+ o.m_debugId = data.objectId;
+ o.m_class = data.objectType;
+ o.m_idString = data.idString;
+ o.m_name = data.objectName;
+ o.m_source.m_url = data.url;
+ o.m_source.m_lineNumber = data.lineNumber;
+ o.m_source.m_columnNumber = data.columnNumber;
+ o.m_contextDebugId = data.contextId;
+
+ if (simple)
+ return;
+
+ int childCount;
+ bool recur;
+ ds >> childCount >> recur;
+
+ for (int ii = 0; ii < childCount; ++ii) {
+ o.m_children.append(QQmlDebugObjectReference());
+ decode(ds, o.m_children.last(), !recur);
+ }
+
+ int propCount;
+ ds >> propCount;
+
+ for (int ii = 0; ii < propCount; ++ii) {
+ QQmlEngineDebugService::QQmlObjectProperty data;
+ ds >> data;
+ QQmlDebugPropertyReference prop;
+ prop.m_objectDebugId = o.m_debugId;
+ prop.m_name = data.name;
+ prop.m_binding = data.binding;
+ prop.m_hasNotifySignal = data.hasNotifySignal;
+ prop.m_valueTypeName = data.valueTypeName;
+ switch (data.type) {
+ case QQmlEngineDebugService::QQmlObjectProperty::Basic:
+ case QQmlEngineDebugService::QQmlObjectProperty::List:
+ case QQmlEngineDebugService::QQmlObjectProperty::SignalProperty:
+ {
+ prop.m_value = data.value;
+ break;
+ }
+ case QQmlEngineDebugService::QQmlObjectProperty::Object:
+ {
+ QQmlDebugObjectReference obj;
+ obj.m_debugId = prop.m_value.toInt();
+ prop.m_value = QVariant::fromValue(obj);
+ break;
+ }
+ case QQmlEngineDebugService::QQmlObjectProperty::Unknown:
+ break;
+ }
+ o.m_properties << prop;
+ }
+}
+
+void QQmlEngineDebugPrivate::decode(QDataStream &ds, QQmlDebugContextReference &c)
+{
+ ds >> c.m_name >> c.m_debugId;
+
+ int contextCount;
+ ds >> contextCount;
+
+ for (int ii = 0; ii < contextCount; ++ii) {
+ c.m_contexts.append(QQmlDebugContextReference());
+ decode(ds, c.m_contexts.last());
+ }
+
+ int objectCount;
+ ds >> objectCount;
+
+ for (int ii = 0; ii < objectCount; ++ii) {
+ QQmlDebugObjectReference obj;
+ decode(ds, obj, true);
+
+ obj.m_contextDebugId = c.m_debugId;
+ c.m_objects << obj;
+ }
+}
+
+void QQmlEngineDebugPrivate::stateChanged(QQmlEngineDebug::State status)
+{
+ emit q_func()->stateChanged(status);
+}
+
+void QQmlEngineDebugPrivate::message(const QByteArray &data)
+{
+ QDataStream ds(data);
+
+ QByteArray type;
+ ds >> type;
+
+ //qDebug() << "QQmlEngineDebugPrivate::message()" << type;
+
+ if (type == "LIST_ENGINES_R") {
+ int queryId;
+ ds >> queryId;
+
+ QQmlDebugEnginesQuery *query = enginesQuery.value(queryId);
+ if (!query)
+ return;
+ enginesQuery.remove(queryId);
+
+ int count;
+ ds >> count;
+
+ for (int ii = 0; ii < count; ++ii) {
+ QQmlDebugEngineReference ref;
+ ds >> ref.m_name;
+ ds >> ref.m_debugId;
+ query->m_engines << ref;
+ }
+
+ query->m_client = 0;
+ query->setState(QQmlDebugQuery::Completed);
+ } else if (type == "LIST_OBJECTS_R") {
+ int queryId;
+ ds >> queryId;
+
+ QQmlDebugRootContextQuery *query = rootContextQuery.value(queryId);
+ if (!query)
+ return;
+ rootContextQuery.remove(queryId);
+
+ if (!ds.atEnd())
+ decode(ds, query->m_context);
+
+ query->m_client = 0;
+ query->setState(QQmlDebugQuery::Completed);
+ } else if (type == "FETCH_OBJECT_R") {
+ int queryId;
+ ds >> queryId;
+
+ QQmlDebugObjectQuery *query = objectQuery.value(queryId);
+ if (!query)
+ return;
+ objectQuery.remove(queryId);
+
+ if (!ds.atEnd())
+ decode(ds, query->m_object, false);
+
+ query->m_client = 0;
+ query->setState(QQmlDebugQuery::Completed);
+ } else if (type == "EVAL_EXPRESSION_R") {
+ int queryId;
+ QVariant result;
+ ds >> queryId >> result;
+
+ QQmlDebugExpressionQuery *query = expressionQuery.value(queryId);
+ if (!query)
+ return;
+ expressionQuery.remove(queryId);
+
+ query->m_result = result;
+ query->m_client = 0;
+ query->setState(QQmlDebugQuery::Completed);
+ } else if (type == "WATCH_PROPERTY_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QQmlDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QQmlDebugWatch::Active : QQmlDebugWatch::Inactive);
+ } else if (type == "WATCH_OBJECT_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QQmlDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QQmlDebugWatch::Active : QQmlDebugWatch::Inactive);
+ } else if (type == "WATCH_EXPR_OBJECT_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QQmlDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QQmlDebugWatch::Active : QQmlDebugWatch::Inactive);
+ } else if (type == "UPDATE_WATCH") {
+ int queryId;
+ int debugId;
+ QByteArray name;
+ QVariant value;
+ ds >> queryId >> debugId >> name >> value;
+
+ QQmlDebugWatch *watch = watched.value(queryId, 0);
+ if (!watch)
+ return;
+ emit watch->valueChanged(name, value);
+ } else if (type == "OBJECT_CREATED") {
+ emit q_func()->newObjects();
+ }
+}
+
+QQmlEngineDebug::QQmlEngineDebug(QQmlDebugConnection *client, QObject *parent)
+ : QObject(*(new QQmlEngineDebugPrivate(client)), parent)
+{
+}
+
+QQmlEngineDebug::~QQmlEngineDebug()
+{
+}
+
+QQmlEngineDebug::State QQmlEngineDebug::state() const
+{
+ Q_D(const QQmlEngineDebug);
+
+ return static_cast<QQmlEngineDebug::State>(d->client->state());
+}
+
+QQmlDebugPropertyWatch *QQmlEngineDebug::addWatch(const QQmlDebugPropertyReference &property, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugPropertyWatch *watch = new QQmlDebugPropertyWatch(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = property.objectDebugId();
+ watch->m_name = property.name();
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8();
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QQmlDebugWatch::Dead;
+ }
+
+ return watch;
+}
+
+QQmlDebugWatch *QQmlEngineDebug::addWatch(const QQmlDebugContextReference &, const QString &, QObject *)
+{
+ qWarning("QQmlEngineDebug::addWatch(): Not implemented");
+ return 0;
+}
+
+QQmlDebugObjectExpressionWatch *QQmlEngineDebug::addWatch(const QQmlDebugObjectReference &object, const QString &expr, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+ QQmlDebugObjectExpressionWatch *watch = new QQmlDebugObjectExpressionWatch(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = object.debugId();
+ watch->m_expr = expr;
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr;
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QQmlDebugWatch::Dead;
+ }
+ return watch;
+}
+
+QQmlDebugWatch *QQmlEngineDebug::addWatch(const QQmlDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugWatch *watch = new QQmlDebugWatch(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = object.debugId();
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId();
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QQmlDebugWatch::Dead;
+ }
+
+ return watch;
+}
+
+QQmlDebugWatch *QQmlEngineDebug::addWatch(const QQmlDebugFileReference &, QObject *)
+{
+ qWarning("QQmlEngineDebug::addWatch(): Not implemented");
+ return 0;
+}
+
+void QQmlEngineDebug::removeWatch(QQmlDebugWatch *watch)
+{
+ Q_D(QQmlEngineDebug);
+
+ if (!watch || !watch->m_client)
+ return;
+
+ watch->m_client = 0;
+ watch->setState(QQmlDebugWatch::Inactive);
+
+ d->watched.remove(watch->queryId());
+
+ if (d->client && d->client->state() == QQmlDebugClient::Enabled) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("NO_WATCH") << watch->queryId();
+ d->client->sendMessage(message);
+ }
+}
+
+QQmlDebugEnginesQuery *QQmlEngineDebug::queryAvailableEngines(QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugEnginesQuery *query = new QQmlDebugEnginesQuery(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->enginesQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_ENGINES") << queryId;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QQmlDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QQmlDebugRootContextQuery *QQmlEngineDebug::queryRootContexts(const QQmlDebugEngineReference &engine, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugRootContextQuery *query = new QQmlDebugRootContextQuery(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled && engine.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->rootContextQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId();
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QQmlDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QQmlDebugObjectQuery *QQmlEngineDebug::queryObject(const QQmlDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugObjectQuery *query = new QQmlDebugObjectQuery(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled && object.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->objectQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
+ << false << true;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QQmlDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QQmlDebugObjectQuery *QQmlEngineDebug::queryObjectRecursive(const QQmlDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugObjectQuery *query = new QQmlDebugObjectQuery(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled && object.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->objectQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
+ << true << true;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QQmlDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QQmlDebugExpressionQuery *QQmlEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent)
+{
+ Q_D(QQmlEngineDebug);
+
+ QQmlDebugExpressionQuery *query = new QQmlDebugExpressionQuery(parent);
+ if (d->client->state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ query->m_client = this;
+ query->m_expr = expr;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->expressionQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QQmlDebugQuery::Error;
+ }
+
+ return query;
+}
+
+bool QQmlEngineDebug::setBindingForObject(int objectDebugId, const QString &propertyName,
+ const QVariant &bindingExpression,
+ bool isLiteralValue,
+ QString source, int line)
+{
+ Q_D(QQmlEngineDebug);
+
+ if (d->client->state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue << source << line;
+ d->client->sendMessage(message);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool QQmlEngineDebug::resetBindingForObject(int objectDebugId, const QString &propertyName)
+{
+ Q_D(QQmlEngineDebug);
+
+ if (d->client->state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
+ d->client->sendMessage(message);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool QQmlEngineDebug::setMethodBody(int objectDebugId, const QString &methodName,
+ const QString &methodBody)
+{
+ Q_D(QQmlEngineDebug);
+
+ if (d->client->state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("SET_METHOD_BODY") << objectDebugId << methodName << methodBody;
+ d->client->sendMessage(message);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+QQmlDebugWatch::QQmlDebugWatch(QObject *parent)
+ : QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1)
+{
+}
+
+QQmlDebugWatch::~QQmlDebugWatch()
+{
+ if (m_client && m_queryId != -1)
+ QQmlEngineDebugPrivate::remove(m_client, this);
+}
+
+int QQmlDebugWatch::queryId() const
+{
+ return m_queryId;
+}
+
+int QQmlDebugWatch::objectDebugId() const
+{
+ return m_objectDebugId;
+}
+
+QQmlDebugWatch::State QQmlDebugWatch::state() const
+{
+ return m_state;
+}
+
+void QQmlDebugWatch::setState(State s)
+{
+ if (m_state == s)
+ return;
+ m_state = s;
+ emit stateChanged(m_state);
+}
+
+QQmlDebugPropertyWatch::QQmlDebugPropertyWatch(QObject *parent)
+ : QQmlDebugWatch(parent)
+{
+}
+
+QString QQmlDebugPropertyWatch::name() const
+{
+ return m_name;
+}
+
+
+QQmlDebugObjectExpressionWatch::QQmlDebugObjectExpressionWatch(QObject *parent)
+ : QQmlDebugWatch(parent)
+{
+}
+
+QString QQmlDebugObjectExpressionWatch::expression() const
+{
+ return m_expr;
+}
+
+
+QQmlDebugQuery::QQmlDebugQuery(QObject *parent)
+ : QObject(parent), m_state(Waiting)
+{
+}
+
+QQmlDebugQuery::State QQmlDebugQuery::state() const
+{
+ return m_state;
+}
+
+bool QQmlDebugQuery::isWaiting() const
+{
+ return m_state == Waiting;
+}
+
+void QQmlDebugQuery::setState(State s)
+{
+ if (m_state == s)
+ return;
+ m_state = s;
+ emit stateChanged(m_state);
+}
+
+QQmlDebugEnginesQuery::QQmlDebugEnginesQuery(QObject *parent)
+ : QQmlDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QQmlDebugEnginesQuery::~QQmlDebugEnginesQuery()
+{
+ if (m_client && m_queryId != -1)
+ QQmlEngineDebugPrivate::remove(m_client, this);
+}
+
+QList<QQmlDebugEngineReference> QQmlDebugEnginesQuery::engines() const
+{
+ return m_engines;
+}
+
+QQmlDebugRootContextQuery::QQmlDebugRootContextQuery(QObject *parent)
+ : QQmlDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QQmlDebugRootContextQuery::~QQmlDebugRootContextQuery()
+{
+ if (m_client && m_queryId != -1)
+ QQmlEngineDebugPrivate::remove(m_client, this);
+}
+
+QQmlDebugContextReference QQmlDebugRootContextQuery::rootContext() const
+{
+ return m_context;
+}
+
+QQmlDebugObjectQuery::QQmlDebugObjectQuery(QObject *parent)
+ : QQmlDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QQmlDebugObjectQuery::~QQmlDebugObjectQuery()
+{
+ if (m_client && m_queryId != -1)
+ QQmlEngineDebugPrivate::remove(m_client, this);
+}
+
+QQmlDebugObjectReference QQmlDebugObjectQuery::object() const
+{
+ return m_object;
+}
+
+QQmlDebugExpressionQuery::QQmlDebugExpressionQuery(QObject *parent)
+ : QQmlDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QQmlDebugExpressionQuery::~QQmlDebugExpressionQuery()
+{
+ if (m_client && m_queryId != -1)
+ QQmlEngineDebugPrivate::remove(m_client, this);
+}
+
+QVariant QQmlDebugExpressionQuery::expression() const
+{
+ return m_expr;
+}
+
+QVariant QQmlDebugExpressionQuery::result() const
+{
+ return m_result;
+}
+
+QQmlDebugEngineReference::QQmlDebugEngineReference()
+ : m_debugId(-1)
+{
+}
+
+QQmlDebugEngineReference::QQmlDebugEngineReference(int debugId)
+ : m_debugId(debugId)
+{
+}
+
+QQmlDebugEngineReference::QQmlDebugEngineReference(const QQmlDebugEngineReference &o)
+ : m_debugId(o.m_debugId), m_name(o.m_name)
+{
+}
+
+QQmlDebugEngineReference &
+QQmlDebugEngineReference::operator=(const QQmlDebugEngineReference &o)
+{
+ m_debugId = o.m_debugId; m_name = o.m_name;
+ return *this;
+}
+
+int QQmlDebugEngineReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QQmlDebugEngineReference::name() const
+{
+ return m_name;
+}
+
+QQmlDebugObjectReference::QQmlDebugObjectReference()
+ : m_debugId(-1), m_contextDebugId(-1)
+{
+}
+
+QQmlDebugObjectReference::QQmlDebugObjectReference(int debugId)
+ : m_debugId(debugId), m_contextDebugId(-1)
+{
+}
+
+QQmlDebugObjectReference::QQmlDebugObjectReference(const QQmlDebugObjectReference &o)
+ : m_debugId(o.m_debugId), m_class(o.m_class), m_idString(o.m_idString),
+ m_name(o.m_name), m_source(o.m_source), m_contextDebugId(o.m_contextDebugId),
+ m_properties(o.m_properties), m_children(o.m_children)
+{
+}
+
+QQmlDebugObjectReference &
+QQmlDebugObjectReference::operator=(const QQmlDebugObjectReference &o)
+{
+ m_debugId = o.m_debugId; m_class = o.m_class; m_idString = o.m_idString;
+ m_name = o.m_name; m_source = o.m_source; m_contextDebugId = o.m_contextDebugId;
+ m_properties = o.m_properties; m_children = o.m_children;
+ return *this;
+}
+
+int QQmlDebugObjectReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QQmlDebugObjectReference::className() const
+{
+ return m_class;
+}
+
+QString QQmlDebugObjectReference::idString() const
+{
+ return m_idString;
+}
+
+QString QQmlDebugObjectReference::name() const
+{
+ return m_name;
+}
+
+QQmlDebugFileReference QQmlDebugObjectReference::source() const
+{
+ return m_source;
+}
+
+int QQmlDebugObjectReference::contextDebugId() const
+{
+ return m_contextDebugId;
+}
+
+QList<QQmlDebugPropertyReference> QQmlDebugObjectReference::properties() const
+{
+ return m_properties;
+}
+
+QList<QQmlDebugObjectReference> QQmlDebugObjectReference::children() const
+{
+ return m_children;
+}
+
+QQmlDebugContextReference::QQmlDebugContextReference()
+ : m_debugId(-1)
+{
+}
+
+QQmlDebugContextReference::QQmlDebugContextReference(const QQmlDebugContextReference &o)
+ : m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts)
+{
+}
+
+QQmlDebugContextReference &QQmlDebugContextReference::operator=(const QQmlDebugContextReference &o)
+{
+ m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects;
+ m_contexts = o.m_contexts;
+ return *this;
+}
+
+int QQmlDebugContextReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QQmlDebugContextReference::name() const
+{
+ return m_name;
+}
+
+QList<QQmlDebugObjectReference> QQmlDebugContextReference::objects() const
+{
+ return m_objects;
+}
+
+QList<QQmlDebugContextReference> QQmlDebugContextReference::contexts() const
+{
+ return m_contexts;
+}
+
+QQmlDebugFileReference::QQmlDebugFileReference()
+ : m_lineNumber(-1), m_columnNumber(-1)
+{
+}
+
+QQmlDebugFileReference::QQmlDebugFileReference(const QQmlDebugFileReference &o)
+ : m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber)
+{
+}
+
+QQmlDebugFileReference &QQmlDebugFileReference::operator=(const QQmlDebugFileReference &o)
+{
+ m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber;
+ return *this;
+}
+
+QUrl QQmlDebugFileReference::url() const
+{
+ return m_url;
+}
+
+void QQmlDebugFileReference::setUrl(const QUrl &u)
+{
+ m_url = u;
+}
+
+int QQmlDebugFileReference::lineNumber() const
+{
+ return m_lineNumber;
+}
+
+void QQmlDebugFileReference::setLineNumber(int l)
+{
+ m_lineNumber = l;
+}
+
+int QQmlDebugFileReference::columnNumber() const
+{
+ return m_columnNumber;
+}
+
+void QQmlDebugFileReference::setColumnNumber(int c)
+{
+ m_columnNumber = c;
+}
+
+QQmlDebugPropertyReference::QQmlDebugPropertyReference()
+ : m_objectDebugId(-1), m_hasNotifySignal(false)
+{
+}
+
+QQmlDebugPropertyReference::QQmlDebugPropertyReference(const QQmlDebugPropertyReference &o)
+ : m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value),
+ m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding),
+ m_hasNotifySignal(o.m_hasNotifySignal)
+{
+}
+
+QQmlDebugPropertyReference &QQmlDebugPropertyReference::operator=(const QQmlDebugPropertyReference &o)
+{
+ m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value;
+ m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding;
+ m_hasNotifySignal = o.m_hasNotifySignal;
+ return *this;
+}
+
+int QQmlDebugPropertyReference::objectDebugId() const
+{
+ return m_objectDebugId;
+}
+
+QString QQmlDebugPropertyReference::name() const
+{
+ return m_name;
+}
+
+QString QQmlDebugPropertyReference::valueTypeName() const
+{
+ return m_valueTypeName;
+}
+
+QVariant QQmlDebugPropertyReference::value() const
+{
+ return m_value;
+}
+
+QString QQmlDebugPropertyReference::binding() const
+{
+ return m_binding;
+}
+
+bool QQmlDebugPropertyReference::hasNotifySignal() const
+{
+ return m_hasNotifySignal;
+}
+
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
new file mode 100644
index 0000000000..70f04d3a19
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
@@ -0,0 +1,388 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLENGINEDEBUG_H
+#define QQMLENGINEDEBUG_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include <QtCore/qvariant.h>
+
+#include <private/qtqmlglobal_p.h>
+
+class QQmlDebugConnection;
+class QQmlDebugWatch;
+class QQmlDebugPropertyWatch;
+class QQmlDebugObjectExpressionWatch;
+class QQmlDebugEnginesQuery;
+class QQmlDebugRootContextQuery;
+class QQmlDebugObjectQuery;
+class QQmlDebugExpressionQuery;
+class QQmlDebugPropertyReference;
+class QQmlDebugContextReference;
+class QQmlDebugObjectReference;
+class QQmlDebugFileReference;
+class QQmlDebugEngineReference;
+class QQmlEngineDebugPrivate;
+class Q_QML_PRIVATE_EXPORT QQmlEngineDebug : public QObject
+{
+ Q_OBJECT
+public:
+ enum State { NotConnected, Unavailable, Enabled };
+
+ explicit QQmlEngineDebug(QQmlDebugConnection *, QObject * = 0);
+ ~QQmlEngineDebug();
+
+ State state() const;
+
+ QQmlDebugPropertyWatch *addWatch(const QQmlDebugPropertyReference &,
+ QObject *parent = 0);
+ QQmlDebugWatch *addWatch(const QQmlDebugContextReference &, const QString &,
+ QObject *parent = 0);
+ QQmlDebugObjectExpressionWatch *addWatch(const QQmlDebugObjectReference &, const QString &,
+ QObject *parent = 0);
+ QQmlDebugWatch *addWatch(const QQmlDebugObjectReference &,
+ QObject *parent = 0);
+ QQmlDebugWatch *addWatch(const QQmlDebugFileReference &,
+ QObject *parent = 0);
+
+ void removeWatch(QQmlDebugWatch *watch);
+
+ QQmlDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
+ QQmlDebugRootContextQuery *queryRootContexts(const QQmlDebugEngineReference &,
+ QObject *parent = 0);
+ QQmlDebugObjectQuery *queryObject(const QQmlDebugObjectReference &,
+ QObject *parent = 0);
+ QQmlDebugObjectQuery *queryObjectRecursive(const QQmlDebugObjectReference &,
+ QObject *parent = 0);
+ QQmlDebugExpressionQuery *queryExpressionResult(int objectDebugId,
+ const QString &expr,
+ QObject *parent = 0);
+ bool setBindingForObject(int objectDebugId, const QString &propertyName,
+ const QVariant &bindingExpression, bool isLiteralValue,
+ QString source = QString(), int line = -1);
+ bool resetBindingForObject(int objectDebugId, const QString &propertyName);
+ bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
+
+Q_SIGNALS:
+ void newObjects();
+ void stateChanged(State state);
+
+private:
+ Q_DECLARE_PRIVATE(QQmlEngineDebug)
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugWatch : public QObject
+{
+ Q_OBJECT
+public:
+ enum State { Waiting, Active, Inactive, Dead };
+
+ QQmlDebugWatch(QObject *);
+ ~QQmlDebugWatch();
+
+ int queryId() const;
+ int objectDebugId() const;
+ State state() const;
+
+Q_SIGNALS:
+ void stateChanged(QQmlDebugWatch::State);
+ //void objectChanged(int, const QQmlDebugObjectReference &);
+ //void valueChanged(int, const QVariant &);
+
+ // Server sends value as string if it is a user-type variant
+ void valueChanged(const QByteArray &name, const QVariant &value);
+
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ void setState(State);
+ State m_state;
+ int m_queryId;
+ QQmlEngineDebug *m_client;
+ int m_objectDebugId;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyWatch : public QQmlDebugWatch
+{
+ Q_OBJECT
+public:
+ QQmlDebugPropertyWatch(QObject *parent);
+
+ QString name() const;
+
+private:
+ friend class QQmlEngineDebug;
+ QString m_name;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugObjectExpressionWatch : public QQmlDebugWatch
+{
+ Q_OBJECT
+public:
+ QQmlDebugObjectExpressionWatch(QObject *parent);
+
+ QString expression() const;
+
+private:
+ friend class QQmlEngineDebug;
+ QString m_expr;
+ int m_debugId;
+};
+
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugQuery : public QObject
+{
+ Q_OBJECT
+public:
+ enum State { Waiting, Error, Completed };
+
+ State state() const;
+ bool isWaiting() const;
+
+Q_SIGNALS:
+ void stateChanged(QQmlDebugQuery::State);
+
+protected:
+ QQmlDebugQuery(QObject *);
+
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ void setState(State);
+ State m_state;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugFileReference
+{
+public:
+ QQmlDebugFileReference();
+ QQmlDebugFileReference(const QQmlDebugFileReference &);
+ QQmlDebugFileReference &operator=(const QQmlDebugFileReference &);
+
+ QUrl url() const;
+ void setUrl(const QUrl &);
+ int lineNumber() const;
+ void setLineNumber(int);
+ int columnNumber() const;
+ void setColumnNumber(int);
+
+private:
+ friend class QQmlEngineDebugPrivate;
+ QUrl m_url;
+ int m_lineNumber;
+ int m_columnNumber;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugEngineReference
+{
+public:
+ QQmlDebugEngineReference();
+ QQmlDebugEngineReference(int);
+ QQmlDebugEngineReference(const QQmlDebugEngineReference &);
+ QQmlDebugEngineReference &operator=(const QQmlDebugEngineReference &);
+
+ int debugId() const;
+ QString name() const;
+
+private:
+ friend class QQmlEngineDebugPrivate;
+ int m_debugId;
+ QString m_name;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugObjectReference
+{
+public:
+ QQmlDebugObjectReference();
+ QQmlDebugObjectReference(int);
+ QQmlDebugObjectReference(const QQmlDebugObjectReference &);
+ QQmlDebugObjectReference &operator=(const QQmlDebugObjectReference &);
+
+ int debugId() const;
+ QString className() const;
+ QString idString() const;
+ QString name() const;
+
+ QQmlDebugFileReference source() const;
+ int contextDebugId() const;
+
+ QList<QQmlDebugPropertyReference> properties() const;
+ QList<QQmlDebugObjectReference> children() const;
+
+private:
+ friend class QQmlEngineDebugPrivate;
+ int m_debugId;
+ QString m_class;
+ QString m_idString;
+ QString m_name;
+ QQmlDebugFileReference m_source;
+ int m_contextDebugId;
+ QList<QQmlDebugPropertyReference> m_properties;
+ QList<QQmlDebugObjectReference> m_children;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugContextReference
+{
+public:
+ QQmlDebugContextReference();
+ QQmlDebugContextReference(const QQmlDebugContextReference &);
+ QQmlDebugContextReference &operator=(const QQmlDebugContextReference &);
+
+ int debugId() const;
+ QString name() const;
+
+ QList<QQmlDebugObjectReference> objects() const;
+ QList<QQmlDebugContextReference> contexts() const;
+
+private:
+ friend class QQmlEngineDebugPrivate;
+ int m_debugId;
+ QString m_name;
+ QList<QQmlDebugObjectReference> m_objects;
+ QList<QQmlDebugContextReference> m_contexts;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyReference
+{
+public:
+ QQmlDebugPropertyReference();
+ QQmlDebugPropertyReference(const QQmlDebugPropertyReference &);
+ QQmlDebugPropertyReference &operator=(const QQmlDebugPropertyReference &);
+
+ int objectDebugId() const;
+ QString name() const;
+ QVariant value() const;
+ QString valueTypeName() const;
+ QString binding() const;
+ bool hasNotifySignal() const;
+
+private:
+ friend class QQmlEngineDebugPrivate;
+ int m_objectDebugId;
+ QString m_name;
+ QVariant m_value;
+ QString m_valueTypeName;
+ QString m_binding;
+ bool m_hasNotifySignal;
+};
+
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugEnginesQuery : public QQmlDebugQuery
+{
+ Q_OBJECT
+public:
+ virtual ~QQmlDebugEnginesQuery();
+ QList<QQmlDebugEngineReference> engines() const;
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ QQmlDebugEnginesQuery(QObject *);
+ QQmlEngineDebug *m_client;
+ int m_queryId;
+ QList<QQmlDebugEngineReference> m_engines;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugRootContextQuery : public QQmlDebugQuery
+{
+ Q_OBJECT
+public:
+ virtual ~QQmlDebugRootContextQuery();
+ QQmlDebugContextReference rootContext() const;
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ QQmlDebugRootContextQuery(QObject *);
+ QQmlEngineDebug *m_client;
+ int m_queryId;
+ QQmlDebugContextReference m_context;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugObjectQuery : public QQmlDebugQuery
+{
+ Q_OBJECT
+public:
+ virtual ~QQmlDebugObjectQuery();
+ QQmlDebugObjectReference object() const;
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ QQmlDebugObjectQuery(QObject *);
+ QQmlEngineDebug *m_client;
+ int m_queryId;
+ QQmlDebugObjectReference m_object;
+
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlDebugExpressionQuery : public QQmlDebugQuery
+{
+ Q_OBJECT
+public:
+ virtual ~QQmlDebugExpressionQuery();
+ QVariant expression() const;
+ QVariant result() const;
+private:
+ friend class QQmlEngineDebug;
+ friend class QQmlEngineDebugPrivate;
+ QQmlDebugExpressionQuery(QObject *);
+ QQmlEngineDebug *m_client;
+ int m_queryId;
+ QVariant m_expr;
+ QVariant m_result;
+};
+
+Q_DECLARE_METATYPE(QQmlDebugEngineReference)
+Q_DECLARE_METATYPE(QQmlDebugObjectReference)
+Q_DECLARE_METATYPE(QQmlDebugContextReference)
+Q_DECLARE_METATYPE(QQmlDebugPropertyReference)
+
+#endif // QQMLENGINEDEBUG_H
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
index 23f1e90417..962e8dd474 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
@@ -71,19 +71,5 @@ Item {
success = false;
if (!verifyExpected(msco.intListProperty, 4))
success = false;
-
- // NOTE: while these two operations are technically
- // fine, we expect std::bad_alloc exceptions here
- // which we handle in the sequence wrapper.
- msco.intListProperty.length = maxIndex;
- if (msco.intListProperty.length != expectedLength)
- success = false;
- if (!verifyExpected(msco.intListProperty, 4))
- success = false;
- msco.intListProperty[maxIndex] = 15;
- if (msco.intListProperty.length != expectedLength)
- success = false;
- if (!verifyExpected(msco.intListProperty, 4))
- success = false;
}
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index f8b268199d..4389fe5cb7 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4655,13 +4655,9 @@ void tst_qqmlecmascript::sequenceConversionIndexes()
QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set");
QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set");
QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get");
- QString w4 = qmlFile.toString() + QLatin1String(":78: std::bad_alloc during length set");
- QString w5 = qmlFile.toString() + QLatin1String(":83: std::bad_alloc during indexed set");
QTest::ignoreMessage(QtWarningMsg, qPrintable(w1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w4));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w5));
QMetaObject::invokeMethod(object, "indexedAccess");
QVERIFY(object->property("success").toBool());
delete object;
diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
index 3fcce60bfb..69a8d2ecd8 100644
--- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
+++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
@@ -139,6 +139,7 @@ private slots:
void role_mode();
void dynamic_role();
void dynamic_role_data();
+ void string_to_list_crash();
};
bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVariant object)
@@ -1627,6 +1628,19 @@ void tst_qquicklistmodel::dynamic_role()
qApp->processEvents();
}
+void tst_qquicklistmodel::string_to_list_crash()
+{
+ QQmlEngine engine;
+ QQuickListModel model;
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+ QString script = QLatin1String("{append({'a':'data'});get(0).a = [{'x':123}]}");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Can't assign to existing role 'a' of different type [String -> List]");
+ QQmlExpression e(engine.rootContext(), &model, script);
+ // Don't crash!
+ e.evaluate();
+}
+
QTEST_MAIN(tst_qquicklistmodel)
#include "tst_qquicklistmodel.moc"
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess2.qml b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
new file mode 100644
index 0000000000..2f0e0db01c
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
@@ -0,0 +1,5 @@
+import Qt.v4 1.0
+
+Result {
+ result: nested2.result
+}
diff --git a/tests/auto/qml/v4/testtypes.h b/tests/auto/qml/v4/testtypes.h
index 02ba721839..18b5b27b36 100644
--- a/tests/auto/qml/v4/testtypes.h
+++ b/tests/auto/qml/v4/testtypes.h
@@ -59,6 +59,7 @@ class ResultObject : public QObject
Q_OBJECT
Q_PROPERTY(int result READ result WRITE setResult FINAL)
Q_PROPERTY(NestedObject *nested READ nested CONSTANT)
+ Q_PROPERTY(NestedObject *nested2 READ nested2 FINAL CONSTANT)
public:
ResultObject() : m_result(0), m_resultCounter(0) {}
@@ -69,12 +70,14 @@ public:
void setResult(int result) { m_result = result; m_resultCounter++; }
NestedObject *nested() { return &m_nested; }
+ NestedObject *nested2() { return &m_nested2; }
private:
int m_result;
int m_resultCounter;
NestedObject m_nested;
+ NestedObject m_nested2;
};
void registerTypes();
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index 4e3e71f717..041d9ab8e6 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -225,17 +225,34 @@ void tst_v4::conditionalExpr()
// NestedObject::result.
void tst_v4::nestedObjectAccess()
{
- QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
- QCOMPARE(ro->result(), 37);
+ QCOMPARE(ro->result(), 37);
- delete o;
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QEXPECT_FAIL("","QTBUG-24606", Continue);
+ QCOMPARE(ro->result(), 37);
+
+ delete o;
+ }
}
void tst_v4::subscriptionsInConditionalExpressions()
diff --git a/tests/auto/quick/qquickgridview/data/multipleTransitions.qml b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
index f0d932082b..cfe0be7b1e 100644
--- a/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
+++ b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
@@ -60,6 +60,7 @@ Rectangle {
add: Transition {
id: addTargets
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: grid.runningAddTargets = true }
ParallelAnimation {
@@ -72,6 +73,7 @@ Rectangle {
addDisplaced: Transition {
id: addDisplaced
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: grid.runningAddDisplaced = true }
ParallelAnimation {
@@ -84,6 +86,7 @@ Rectangle {
move: Transition {
id: moveTargets
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningMoveTargets = true }
ParallelAnimation {
@@ -96,6 +99,7 @@ Rectangle {
moveDisplaced: Transition {
id: moveDisplaced
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningMoveDisplaced = true }
ParallelAnimation {
@@ -108,6 +112,7 @@ Rectangle {
remove: Transition {
id: removeTargets
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningRemoveTargets = true }
ParallelAnimation {
@@ -120,6 +125,7 @@ Rectangle {
removeDisplaced: Transition {
id: removeDisplaced
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningRemoveDisplaced = true }
ParallelAnimation {
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 66c98cda84..04bdfc8ac3 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -4795,6 +4795,9 @@ void tst_QQuickGridView::multipleTransitions()
QFETCH(int, initialCount);
QFETCH(qreal, contentY);
QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
QFETCH(bool, rippleAddDisplaced);
// add transitions on the left, moves on the right
@@ -4818,6 +4821,9 @@ void tst_QQuickGridView::multipleTransitions()
ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
canvas->setSource(testFileUrl("multipleTransitions.qml"));
canvas->show();
@@ -4901,8 +4907,8 @@ void tst_QQuickGridView::multipleTransitions()
for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
- QCOMPARE(item->x(), (i%3)*80.0);
- QCOMPARE(item->y(), (i/3)*60.0);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
QVERIFY(name != 0);
QTRY_COMPARE(name->text(), model.name(i));
@@ -4916,6 +4922,9 @@ void tst_QQuickGridView::multipleTransitions_data()
QTest::addColumn<int>("initialCount");
QTest::addColumn<qreal>("contentY");
QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
QTest::addColumn<bool>("rippleAddDisplaced");
// the added item and displaced items should move to final dest correctly
@@ -4923,14 +4932,14 @@ void tst_QQuickGridView::multipleTransitions_data()
<< ListChange::insert(0, 1)
<< ListChange::move(0, 3, 1)
)
- << false;
+ << true << true << true << false;
// items affected by the add should change from move to add transition
QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::move(1, 10, 3)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
// items should be placed correctly if you trigger a transition then refill for that index
QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
@@ -4939,13 +4948,31 @@ void tst_QQuickGridView::multipleTransitions_data()
<< ListChange::setContentY(0.0)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::insert(1, 1)
<< ListChange::remove(1, 1)
)
- << true;
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
}
void tst_QQuickGridView::cacheBuffer()
diff --git a/tests/auto/quick/qquicklistview/data/multipleTransitions.qml b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
index 68efeea2ec..c0e888c6c6 100644
--- a/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
+++ b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
@@ -58,6 +58,7 @@ Rectangle {
add: Transition {
id: addTargets
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: list.runningAddTargets = true }
ParallelAnimation {
@@ -70,6 +71,7 @@ Rectangle {
addDisplaced: Transition {
id: addDisplaced
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: list.runningAddDisplaced = true }
PauseAnimation { duration: rippleAddDisplaced ? addDisplaced.ViewTransition.index * root.duration/10 : 0 }
@@ -83,6 +85,7 @@ Rectangle {
move: Transition {
id: moveTargets
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningMoveTargets = true }
ParallelAnimation {
@@ -95,6 +98,7 @@ Rectangle {
moveDisplaced: Transition {
id: moveDisplaced
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningMoveDisplaced = true }
ParallelAnimation {
@@ -107,6 +111,7 @@ Rectangle {
remove: Transition {
id: removeTargets
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningRemoveTargets = true }
ParallelAnimation {
@@ -119,6 +124,7 @@ Rectangle {
removeDisplaced: Transition {
id: removeDisplaced
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningRemoveDisplaced = true }
ParallelAnimation {
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index dcc2e9dd16..c038faa0f1 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -5807,6 +5807,9 @@ void tst_QQuickListView::multipleTransitions()
QFETCH(int, initialCount);
QFETCH(qreal, contentY);
QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
QFETCH(bool, rippleAddDisplaced);
QPointF addTargets_transitionFrom(-50, -50);
@@ -5831,6 +5834,9 @@ void tst_QQuickListView::multipleTransitions()
ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
canvas->setSource(testFileUrl("multipleTransitions.qml"));
canvas->show();
@@ -5918,6 +5924,9 @@ void tst_QQuickListView::multipleTransitions_data()
QTest::addColumn<int>("initialCount");
QTest::addColumn<qreal>("contentY");
QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
QTest::addColumn<bool>("rippleAddDisplaced");
// the added item and displaced items should move to final dest correctly
@@ -5925,14 +5934,14 @@ void tst_QQuickListView::multipleTransitions_data()
<< ListChange::insert(0, 1)
<< ListChange::move(0, 3, 1)
)
- << false;
+ << true << true << true << false;
// items affected by the add should change from move to add transition
QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::move(1, 10, 3)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
// items should be placed correctly if you trigger a transition then refill for that index
QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
@@ -5941,13 +5950,31 @@ void tst_QQuickListView::multipleTransitions_data()
<< ListChange::setContentY(0.0)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::insert(1, 1)
<< ListChange::remove(1, 1)
)
- << true;
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
}
QList<int> tst_QQuickListView::toIntList(const QVariantList &list)
diff --git a/tests/auto/quick/qquickmousearea/data/wheel.qml b/tests/auto/quick/qquickmousearea/data/wheel.qml
new file mode 100644
index 0000000000..3e0c0c2a48
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/wheel.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ property var angleDeltaY
+ property real mouseX
+ property real mouseY
+ property bool controlPressed
+
+ width: 400
+ height: 400
+
+ MouseArea {
+ anchors.fill: parent
+
+ onWheel: {
+ root.angleDeltaY = wheel.angleDelta.y;
+ root.mouseX = wheel.x;
+ root.mouseY = wheel.y;
+ root.controlPressed = wheel.modifiers & Qt.ControlModifier;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 4375e835aa..0b4a6fa438 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -73,6 +73,7 @@ private slots:
void hoverPropagation();
void hoverVisible();
void disableAfterPress();
+ void onWheel();
private:
QQuickView *createView();
@@ -906,6 +907,26 @@ void tst_QQuickMouseArea::disableAfterPress()
delete canvas;
}
+void tst_QQuickMouseArea::onWheel()
+{
+ QQuickView *canvas = createView();
+ canvas->setSource(testFileUrl("wheel.qml"));
+
+ QQuickItem *root = canvas->rootObject();
+ QVERIFY(root != 0);
+
+ QWheelEvent wheelEvent(QPoint(10, 32), QPoint(10, 32), QPoint(60, 20), QPoint(0, 120),
+ 0, Qt::Vertical,Qt::NoButton, Qt::ControlModifier);
+ QGuiApplication::sendEvent(canvas, &wheelEvent);
+
+ QCOMPARE(root->property("angleDeltaY").toInt(), 120);
+ QCOMPARE(root->property("mouseX").toReal(), qreal(10));
+ QCOMPARE(root->property("mouseY").toReal(), qreal(32));
+ QCOMPARE(root->property("controlPressed").toBool(), true);
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_QQuickMouseArea)
#include "tst_qquickmousearea.moc"