Index: unittests/tst_views.cpp =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r4578edcba291c0ffe718f31fb3077a1c931aaa46 --- unittests/tst_views.cpp (.../tst_views.cpp) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision 4578edcba291c0ffe718f31fb3077a1c931aaa46) @@ -16,20 +16,51 @@ // Qt // Project -#include "vtreatmentadjustmentsresponse.h" +#include "vtreatmentadjustmentresponsebase.h" +#include "vtreatmentadjustmentultrafiltrationstate.h" tst_views::tst_views(QObject *parent) : QObject(parent) { } void tst_views::VTreatmentAdjustmentsResponse_text_NoReason() { - View::VTreatmentAdjustmentsResponse v; + View::VTreatmentAdjustmentResponseBase v; v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_NONE); QVERIFY(v.text().isEmpty()); } void tst_views::VTreatmentAdjustmentsResponse_text_WAReason() { - View::VTreatmentAdjustmentsResponse v; + View::VTreatmentAdjustmentResponseBase v; 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 regarding 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 regarding 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); +} +