Index: unittests/tst_messaging.cpp =================================================================== diff -u -ra9b3b248a786b93bf6dfd8c29946d708d18dde9a -re21b48f8a2c42ab879a807c82970b0fb6d1b37d7 --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision a9b3b248a786b93bf6dfd8c29946d708d18dde9a) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision e21b48f8a2c42ab879a807c82970b0fb6d1b37d7) @@ -24,6 +24,8 @@ #include "MessageDispatcher.h" #include "AlarmGenerator.h" +using namespace Can; + tst_messaging::tst_messaging(QObject *parent) : QObject(parent) { } /*! @@ -73,9 +75,13 @@ void tst_messaging::tst_MessageInterpreter_powerOffData() { Can::MessageInterpreter iMsg; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + Can::Message msg; msg.actionId = Gui::GuiActionType::ID_PowerOff; msg.data = {}; + msg.can_id = canId; + QVariantList data; QVERIFY( ! iMsg.interpretMessage(msg, data)); } @@ -416,7 +422,9 @@ { Can::MessageInterpreter iMsg; QByteArray payload; - QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_RawData, {}, payload)); + Can_Id canId = Can::Can_Id::eChlid_NONE; + + QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::ID_RawData, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -452,8 +460,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustBloodDialysateReq, {}, payload)); + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustBloodDialysateReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -466,8 +476,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustDurationReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustDurationReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -480,8 +492,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AlarmSilenceReq, {}, payload)); + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AlarmSilenceReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -494,8 +508,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationInitReq, {}, payload)); + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationInitReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -508,8 +524,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq, {}, payload)); + QVERIFY(! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationStateReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -522,8 +540,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationEditReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -536,8 +556,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustUltrafiltrationConfirmReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -550,8 +572,10 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustSalineReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustSalineReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } @@ -564,17 +588,21 @@ { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustHeparinReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustHeparinReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); } void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustPressuresReq() { Can::MessageInterpreter iMsg; QByteArray payload; + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + // if the payload is empty the len is not valid and should return false and empty payload - QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustPressuresLimitsReq, {}, payload)); + QVERIFY( ! iMsg.interpretMessage(Gui::GuiActionType::ID_AdjustPressuresLimitsReq, {}, payload, canId)); QVERIFY(payload.isEmpty()); }