Index: unittests/tst_views.cpp =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r56e378f7504701b9e9a9dccaf205aef2fd52c58e --- unittests/tst_views.cpp (.../tst_views.cpp) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ unittests/tst_views.cpp (.../tst_views.cpp) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) @@ -2,34 +2,66 @@ * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, - * IN PART OR IN WHOLE, - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file tst_views.cpp - * \date 4/19/2020 - * \author Behrouz NematiPour + * \file tst_views.cpp + * \author (last) Behrouz NemaiPour + * \date (last) 23-Jun-2020 + * \author (original) Behrouz NematiPour + * \date (original) 21-Apr-2020 * */ #include "tst_views.h" // 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); +} +