MCPcopy Create free account
hub / github.com/MycroftAI/mycroft-gui / testClientToServerData

Method testClientToServerData

autotests/servertest.cpp:500–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500void ServerTest::testClientToServerData()
501{
502 const QUrl url(QStringLiteral("file://") + QFINDTESTDATA("currentweather.qml"));
503 AbstractDelegate *delegate = delegateForSkill(QStringLiteral("mycroft.weather"), url);
504 QVERIFY(delegate);
505
506 QSignalSpy propertySpy(m_guiWebSocket, &QWebSocket::textMessageReceived);
507
508 QMetaObject::invokeMethod(delegate, "updateTemperature", Qt::DirectConnection, Q_ARG(QVariant, QStringLiteral("21 °C")));
509 propertySpy.wait();
510
511 QJsonDocument doc = QJsonDocument::fromJson(propertySpy.first().first().toString().toUtf8());
512
513 QVERIFY(!doc.isEmpty());
514 QCOMPARE(doc[QStringLiteral("type")], QStringLiteral("mycroft.session.set"));
515 QCOMPARE(doc[QStringLiteral("namespace")], QStringLiteral("mycroft.weather"));
516 QCOMPARE(doc[QStringLiteral("data")][QStringLiteral("temperature")], QStringLiteral("21 °C"));
517
518 QMetaObject::invokeMethod(delegate, "deleteProperty");
519 propertySpy.wait();
520 doc = QJsonDocument::fromJson(propertySpy[1].first().toString().toUtf8());
521
522 QCOMPARE(doc[QStringLiteral("type")], QStringLiteral("mycroft.session.delete"));
523 QCOMPARE(doc[QStringLiteral("namespace")], QStringLiteral("mycroft.weather"));
524 QCOMPARE(doc[QStringLiteral("property")], QStringLiteral("to_delete"));
525}
526
527void ServerTest::testShowSecondGuiPage()
528{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected