| 498 | } |
| 499 | |
| 500 | void 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 | |
| 527 | void ServerTest::testShowSecondGuiPage() |
| 528 | { |
nothing calls this directly
no outgoing calls
no test coverage detected