/*! * * 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. * * \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 "vtreatmentadjustmentresponsebase.h" #include "vtreatmentadjustmentultrafiltrationstate.h" tst_views::tst_views(QObject *parent) : QObject(parent) { } void tst_views::VTreatmentAdjustmentsResponse_text_NoReason() { View::VTreatmentAdjustmentResponseBase v; v.adjustment_Reason(GuiRequestReasons::REQUEST_REJECT_REASON_NONE); QVERIFY(v.text().isEmpty()); } void tst_views::VTreatmentAdjustmentsResponse_text_WAReason() { 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); }