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); +} +