Index: sources/model/mtreatmentadjustrequests.h =================================================================== diff -u -reece7acacf84e8cc34b830f6b5ab3f112823a905 -r0b1e55604d139154b791e1615792921df211ba4d --- sources/model/mtreatmentadjustrequests.h (.../mtreatmentadjustrequests.h) (revision eece7acacf84e8cc34b830f6b5ab3f112823a905) +++ sources/model/mtreatmentadjustrequests.h (.../mtreatmentadjustrequests.h) (revision 0b1e55604d139154b791e1615792921df211ba4d) @@ -32,7 +32,7 @@ quint32 duration = 0; }; - class MAdjustUltrafiltrationStateReq { +class MAdjustUltrafiltrationStateReq { public: enum State{ ePaused = 0, Index: sources/view/vtreatmentadjustmentultrafiltrationstate.cpp =================================================================== diff -u -r7d3062c841b788ced31d939dec990afe0de1442d -r0b1e55604d139154b791e1615792921df211ba4d --- sources/view/vtreatmentadjustmentultrafiltrationstate.cpp (.../vtreatmentadjustmentultrafiltrationstate.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) +++ sources/view/vtreatmentadjustmentultrafiltrationstate.cpp (.../vtreatmentadjustmentultrafiltrationstate.cpp) (revision 0b1e55604d139154b791e1615792921df211ba4d) @@ -56,6 +56,8 @@ */ QString View::VTreatmentAdjustmentUltrafiltrationState::text() { + if (adjustment_Accepted()) return ""; + // if there is a reason (passed) it will be used QString mText = VTreatmentAdjustmentResponseBase::text(); // coco begin validated : Manually tested. @@ -64,19 +66,11 @@ if (! mText.isEmpty()) return mText; // coco end // otherwise a general message will be created/passed. - if (! adjustment_Accepted()) { - qDebug() << "VTreatmentAdjustmentUltrafiltrationState::text()" << true; - switch (_data.requestedState) { - case AdjustUltrafiltrationStateRequestData::eRunning: - mText = tr("Unable to Resume Ultrafiltration or already running"); - break; - - case AdjustUltrafiltrationStateRequestData::ePaused: - mText = tr("Unable to Pause Ultrafiltration or already paused"); - break; - } + if (isPaused()) { + mText = tr("Unable to Resume Ultrafiltration or already running"); } else { - qDebug() << "VTreatmentAdjustmentUltrafiltrationState::text()" << false; + mText = tr("Unable to Pause Ultrafiltration or already paused"); + } return mText; } Index: unittests/tst_views.cpp =================================================================== diff -u -rf160ef9c259a75e8d6120ad962cda648e8f7a9b3 -r0b1e55604d139154b791e1615792921df211ba4d --- unittests/tst_views.cpp (.../tst_views.cpp) (revision f160ef9c259a75e8d6120ad962cda648e8f7a9b3) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision 0b1e55604d139154b791e1615792921df211ba4d) @@ -17,6 +17,7 @@ // Project #include "vtreatmentadjustmentresponsebase.h" +#include "vtreatmentadjustmentultrafiltrationstate.h" tst_views::tst_views(QObject *parent) : QObject(parent) { } @@ -33,3 +34,33 @@ v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE); QVERIFY(! v.text().isEmpty()); } + +void tst_views::VTreatmentAdjustmentUltrafiltrationState_text() +{ + View::VTreatmentAdjustmentUltrafiltrationState v; + + // if accepted then return empty + v.adjustment_Accepted(true); + v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_NONE); + QCOMPARE(v.text(), ""); + + // try rejected + v.adjustment_Accepted(false); + + v.isPaused(true); + // if not accepted and a reason passed then the parent should translate it and return + v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE); + QCOMPARE(v.text(), tr("REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE")); + + // if not accepted and not a reason passed then general message will be returned regardig the paused state + v.isPaused(true); + v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_NONE); + QCOMPARE(v.text(), tr("Unable to Resume Ultrafiltration or already running")); + + // if not accepted and not a reason passed then general message will be returned regardig the paused state + v.isPaused(false); + v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_NONE); + QCOMPARE(v.text(), tr("Unable to Pause Ultrafiltration or already paused")); + v.isPaused(false); +} + Index: unittests/tst_views.h =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r0b1e55604d139154b791e1615792921df211ba4d --- unittests/tst_views.h (.../tst_views.h) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ unittests/tst_views.h (.../tst_views.h) (revision 0b1e55604d139154b791e1615792921df211ba4d) @@ -28,5 +28,7 @@ private slots: void VTreatmentAdjustmentsResponse_text_NoReason(); void VTreatmentAdjustmentsResponse_text_WAReason(); + + void VTreatmentAdjustmentUltrafiltrationState_text(); };