aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-02-05 14:15:47 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-03-20 16:46:04 +0000
commit895a511245ae3750ac41b352cdc6915c8f8dd110 (patch)
treed71abb637b89516f61ee7d2613401ae4ccc7a69f /tests
parent1b6792d3040e013acfa9fa5e39418d5b6a648f4b (diff)
QQmlDebugClient: Make stateChanged a signal
This way we can observe it from the outside and drop all the code that genrated extra signals from the virtual method. Also drop the unused QQmlDebugTestService::stateHasChanged signal to reduce the confusion. Change-Id: Ia37c1eaf8b392e594b0931694f43f84fe09b000c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp9
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp6
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp9
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp1
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.h3
6 files changed, 7 insertions, 23 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index f851688b5e..d2cfd3897a 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -89,21 +89,12 @@ public:
protected:
//inherited from QQmlDebugClient
- void stateChanged(State state);
void messageReceived(const QByteArray &data);
signals:
- void enabled();
void debugOutput();
};
-void QQmlDebugMsgClient::stateChanged(State state)
-{
- if (state == Enabled) {
- emit enabled();
- }
-}
-
void QQmlDebugMsgClient::messageReceived(const QByteArray &data)
{
QPacket ds(connection()->currentDataStreamVersion(), data);
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
index 3cd359cf48..37d4ef1160 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -251,6 +251,8 @@ public:
{
parser = jsEngine.evaluate(QLatin1String("JSON.parse"));
stringify = jsEngine.evaluate(QLatin1String("JSON.stringify"));
+ QObject::connect(this, &QQmlDebugClient::stateChanged,
+ this, &QJSDebugClient::onStateChanged);
}
void connect(bool redundantRefs = false, bool namesAsObjects = false);
@@ -272,7 +274,7 @@ public:
protected:
//inherited from QQmlDebugClient
- void stateChanged(State state);
+ void onStateChanged(State state);
void messageReceived(const QByteArray &data);
signals:
@@ -660,7 +662,7 @@ void QJSDebugClient::disconnect()
sendMessage(packMessage(DISCONNECT, json.toString().toUtf8()));
}
-void QJSDebugClient::stateChanged(State state)
+void QJSDebugClient::onStateChanged(State state)
{
if (state == Enabled)
flushSendBuffer();
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index b38e0bd731..a6f7fa8724 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -92,6 +92,9 @@ QString QQmlDebugTest::connectionStateString(const QQmlDebugConnection *connecti
QQmlDebugTestClient::QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c)
: QQmlDebugClient(s, c)
{
+ connect(this, &QQmlDebugClient::stateChanged, this, [this](QQmlDebugClient::State newState) {
+ QCOMPARE(newState, state());
+ });
}
QByteArray QQmlDebugTestClient::waitForResponse()
@@ -105,12 +108,6 @@ QByteArray QQmlDebugTestClient::waitForResponse()
return lastMsg;
}
-void QQmlDebugTestClient::stateChanged(State stat)
-{
- QCOMPARE(stat, state());
- emit stateHasChanged();
-}
-
void QQmlDebugTestClient::messageReceived(const QByteArray &ba)
{
lastMsg = ba;
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 94ad83bfce..05665f8a28 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -88,11 +88,9 @@ public:
QByteArray waitForResponse();
signals:
- void stateHasChanged();
void serverMessage(const QByteArray &);
protected:
- virtual void stateChanged(State state);
virtual void messageReceived(const QByteArray &ba);
private:
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
index 4dce07d824..896ed608fd 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
@@ -48,5 +48,4 @@ void QQmlDebugTestService::stateAboutToBeChanged(QQmlDebugService::State)
void QQmlDebugTestService::stateChanged(State)
{
Q_ASSERT(QThread::currentThread() != thread());
- emit stateHasChanged();
}
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.h b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
index 37b4a9f98c..9c39c0893d 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
@@ -38,9 +38,6 @@ class QQmlDebugTestService : public QQmlDebugService
public:
QQmlDebugTestService(const QString &s, float version = 1, QObject *parent = 0);
-signals:
- void stateHasChanged();
-
protected:
virtual void messageReceived(const QByteArray &ba);
virtual void stateAboutToBeChanged(State state);