Files
qt5-legatus-legacy/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/ModuleTest/ex_sq_stellungswechsel.cpp
T
2026-08-13 18:33:10 +02:00

48 lines
1.3 KiB
C++
Executable File

#include "ex_sq_stellungswechsel.h"
#include <QJsonDocument>
#include <QtTest/QTest>
#include <QJsonDocument>
#include <AdlerJson/telegrams.h>
#include "msgcompares.h"
#include <AdlerJson/generatetelegrams.h>
TestExStellungswechsel::TestExStellungswechsel()
{
}
QString TestExStellungswechsel::generateStellungswechsel()
{
AdlerJson::ExStellungswechsel req;
GenerateTelegrams::addHeaderData(req, m_saaId);
GenerateTelegrams::generateStellungswechsel(req);
QJsonObject messageObj =req.toJson();
QString message = QString::fromUtf8(QJsonDocument(messageObj).toJson());
return message;
}
void TestExStellungswechsel::testExStellungswechsel()
{
qDebug() << "---------------------------";
qDebug() << "--- EX-Stellungswechsel ---";
QString stellungswechselMessage = generateStellungswechsel();
qDebug() << "EX-Stellungswechsel=" << stellungswechselMessage;
QJsonDocument jsonDoc = QJsonDocument::fromJson(stellungswechselMessage.toUtf8());
const QJsonObject jsonObj = jsonDoc.object();
QJsonObject dataObj = jsonObj[AdlerJson::JsonKeys::DATA()].toObject();
AdlerJson::Stellungswechseldaten stellungswechseldaten;
bool bOk;
AdlerJson::stellungswechseldatenFromJson(dataObj, stellungswechseldaten, bOk);
MsgCompares::compareStellungswechseldaten(stellungswechseldaten);
}