From b841fd03d67f06ae78ebdffbf8c31b0bd17dad7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 4 Mar 2016 11:46:13 +0100 Subject: [PATCH] state changed notification --- tests/auto/jsonrpc/testjsonrpc.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index 0d11228a..bc36e74a 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -213,7 +213,9 @@ void TestJSONRPC::stateChangeEmitsNotifications() QNetworkReply *reply = nam.get(request); reply->deleteLater(); - clientSpy.wait(); + qDebug() << "Waiting for notifications"; + + clientSpy.wait(8000); // Make sure the notification contains all the stuff we expect QVariantList stateChangedVariants = checkNotifications(clientSpy, "Devices.StateChanged"); @@ -221,13 +223,15 @@ void TestJSONRPC::stateChangeEmitsNotifications() qDebug() << "got" << stateChangedVariants.count() << "Devices.StateChanged notifications"; foreach (const QVariant &stateChangedVariant, stateChangedVariants) { - qDebug() << QJsonDocument::fromVariant(stateChangedVariant).toJson(); if (stateChangedVariant.toMap().value("params").toMap().value("stateTypeId").toUuid() == stateTypeId) { found = true; QCOMPARE(stateChangedVariant.toMap().value("params").toMap().value("value").toInt(), newVal); break; } } + if (!found) + qDebug() << QJsonDocument::fromVariant(stateChangedVariants).toJson(); + QVERIFY2(found, "Could not find the correct Devices.StateChanged notification"); // Make sure the logg notification contains all the stuff we expect @@ -246,9 +250,10 @@ void TestJSONRPC::stateChangeEmitsNotifications() break; } } - QVERIFY2(found, "Could not find the correct Events.EventTriggered notification"); - + if (!found) + qDebug() << QJsonDocument::fromVariant(loggEntryAddedVariants).toJson(); + QVERIFY2(found, "Could not find the corresponding Logging.LogEntryAdded notification"); // Make sure the notification contains all the stuff we expect @@ -265,7 +270,10 @@ void TestJSONRPC::stateChangeEmitsNotifications() break; } } - QVERIFY2(found, "Could not find the correct Events.EventTriggered notification"); + if (!found) + qDebug() << QJsonDocument::fromVariant(eventTriggeredVariants).toJson(); + + QVERIFY2(found, "Could not find the corresponding Events.EventTriggered notification"); // Now turn off notifications QCOMPARE(disableNotifications(), true);