Index: simulator/plugins/heparin/interface.ui =================================================================== diff -u -r2b0ff4367443cf0458594c81c32598df5b6c39cb -r0a4b4e4653203852eae6d9edb24116f2147a7c3e --- simulator/plugins/heparin/interface.ui (.../interface.ui) (revision 2b0ff4367443cf0458594c81c32598df5b6c39cb) +++ simulator/plugins/heparin/interface.ui (.../interface.ui) (revision 0a4b4e4653203852eae6d9edb24116f2147a7c3e) @@ -6,10 +6,22 @@ 0 0 - 493 + 500 228 + + + 500 + 228 + + + + + 16777215 + 228 + + Heparin @@ -259,7 +271,7 @@ - 20 + 200 Qt::Horizontal @@ -286,7 +298,7 @@ - 2.0 + 20.0 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Index: suite.conf =================================================================== diff -u -r2b0ff4367443cf0458594c81c32598df5b6c39cb -r0a4b4e4653203852eae6d9edb24116f2147a7c3e --- suite.conf (.../suite.conf) (revision 2b0ff4367443cf0458594c81c32598df5b6c39cb) +++ suite.conf (.../suite.conf) (revision 0a4b4e4653203852eae6d9edb24116f2147a7c3e) @@ -5,6 +5,6 @@ IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_Internals tst_HomeScreen tst_ServiceShutdown tst_TreatmentScreen tst_Treatment_Section_BloodDialysate tst_Treatment_BloodDialysateFlowRate tst_Treatment_Time tst_Treatment_Ultrafiltration tst_Treatment_PressureOcclusion tst_Treatment_ParametersRange tst_Treatment_Adjustment_BloodDialysate tst_Treatment_Adjustment_Duration tst_Treatment_Adjustment_Ultrafiltration tst_Treatment_Adjustment_Saline tst_TreatmentSalineData tst_TreatmentStatesData tst_Treatment_Adjustment_Pressures tst_TreatmentHeparineData tst_DGROPumpData tst_DGDrainPumpData tst_DGPressureData tst_DGReservoirData tst_DGHeatersData tst_DGLoadCellReadingsData tst_DGTemperaturesData tst_case2 tst_DGValvesStatesData tst_DGOperationMode tst_HDOperationModeData tst_HDBloodFlowData tst_HDInletFlowData tst_HDOutletFlowData tst_HDPressureOcclusionData tst_CANBusFaultCount tst_DebugText tst_CreateTreatment tst_ConfirmPrimingBegin tst_Alarm_Colors tst_AlarmStatusData tst_AlarmTriggered tst_AlarmCleared +TEST_CASES=tst_Internals tst_HomeScreen tst_ServiceShutdown tst_TreatmentScreen tst_Treatment_Section_BloodDialysate tst_Treatment_BloodDialysateFlowRate tst_Treatment_Time tst_Treatment_Ultrafiltration tst_Treatment_PressureOcclusion tst_Treatment_ParametersRange tst_Treatment_Adjustment_BloodDialysate tst_Treatment_Adjustment_Duration tst_Treatment_Adjustment_Ultrafiltration tst_Treatment_Adjustment_Pressures tst_Treatment_Adjustment_Saline tst_Treatment_Adjustment_Heparin tst_TreatmentSalineData tst_TreatmentStatesData tst_TreatmentHeparineData tst_DGROPumpData tst_DGDrainPumpData tst_DGPressureData tst_DGReservoirData tst_DGHeatersData tst_DGLoadCellReadingsData tst_DGTemperaturesData tst_case2 tst_DGValvesStatesData tst_DGOperationMode tst_HDOperationModeData tst_HDBloodFlowData tst_HDInletFlowData tst_HDOutletFlowData tst_HDPressureOcclusionData tst_CANBusFaultCount tst_DebugText tst_CreateTreatment tst_ConfirmPrimingBegin tst_Alarm_Colors tst_AlarmStatusData tst_AlarmTriggered tst_AlarmCleared VERSION=3 WRAPPERS=Qt Index: tst_TreatmentHeparineData/test.py =================================================================== diff -u -r2b0ff4367443cf0458594c81c32598df5b6c39cb -r0a4b4e4653203852eae6d9edb24116f2147a7c3e --- tst_TreatmentHeparineData/test.py (.../test.py) (revision 2b0ff4367443cf0458594c81c32598df5b6c39cb) +++ tst_TreatmentHeparineData/test.py (.../test.py) (revision 0a4b4e4653203852eae6d9edb24116f2147a7c3e) @@ -16,6 +16,7 @@ import names from dialin.squish import utils, denaliMessages + def getUnit(): global saline_unit saline_unit = str(waitForObjectExists(names.o_treatmentStart_HeparinSection).unit) @@ -27,11 +28,18 @@ test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinSection).title ), "HEPARIN") test.compare( waitForObjectExists(names.o_treatmentStart_HeparinSection).visible , True) + def test_values(vDelivered): - delivered = "{:.1f}".format(vDelivered) - test.compare( waitForObjectExists(names.o_treatmentStart_HeparinSection).valueDelivered, float(delivered) ) - test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinDelivered ).text), delivered) + fDelivered = "{:.1f}".format(vDelivered) + iDelivered = "{}".format(int(vDelivered)) + value = waitForObjectExists(names.o_treatmentStart_HeparinSection).valueDelivered + if value.is_integer(): + print(iDelivered) + test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinDelivered ).text), iDelivered) + else: + test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinDelivered ).text), fDelivered) + def main(): utils.tstStart(__file__) @@ -43,19 +51,18 @@ getUnit() - for value in range(0, 21): + for value in range(0, 101): denaliMessages.setTreatmentHeparinData(value * 0.1) test_values (value * 0.1) - - denaliMessages.setTreatmentHeparinData(2.0) - test_values ( ) + denaliMessages.setTreatmentHeparinData(10.0) + test_values (10.0) - denaliMessages.setTreatmentHeparinData(2.0) - test_values ( ) + denaliMessages.setTreatmentHeparinData(10.0) + test_values (10.0) - denaliMessages.setTreatmentHeparinData( 0) - test_values ( ) + denaliMessages.setTreatmentHeparinData( 0) + test_values ( 0) utils.tstDone() Index: tst_Treatment_Adjustment_Heparin/test.py =================================================================== diff -u --- tst_Treatment_Adjustment_Heparin/test.py (revision 0) +++ tst_Treatment_Adjustment_Heparin/test.py (revision 0a4b4e4653203852eae6d9edb24116f2147a7c3e) @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +## +# 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_Treatment_Adjustment_Heparin +# date 2020/11/24 +# author Behrouz NematiPour +# + + +import names +from dialin.squish import utils, denaliMessages +from dialin.squish.denaliMessages import txStates +from dialin.common.msg_defs import RequestRejectReasons as rejectReason +from numpy.distutils.fcompiler import none + + +def gotoScreenNtest_Contains_TreatmentHeparinData(): + mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) + test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinSection).buttonText), "HEPARIN DELIVERY") + test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinSection).title ), "HEPARIN") + test.compare( waitForObjectExists(names.o_treatmentStart_HeparinSection).visible , True) + utils.waitForGUI(1) + + +def getUnit(): + return str(waitForObjectExists(names.o_treatmentStart_HeparinSection).unit) + + +def test_state(vAccept, vText, vState): + mReason = 0 + if (not vAccept): mReason = rejectReason.REQUEST_REJECT_REASON_HEPARIN_PRESTOP_EXCEEDS_DURATION.value + denaliMessages.setHeparinResponse(vAccept, mReason, vState) + utils.waitForGUI(0.2) + + heparin_button = findObject(names.o_treatmentStart_HeparinPause) # heparin button is not always enable for click + if vState == txStates.HEPARIN_STATE_DISPENSING or vState == txStates.HEPARIN_STATE_PAUSED or vState == txStates.HEPARIN_STATE_COMPLETED : + if not heparin_button is None: + test.compare(heparin_button.enabled, True) + mouseClick(heparin_button) + else: + test.compare(heparin_button.enabled, False) + + test.compare(str(waitForObjectExists(names.o_treatmentStart_HeparinSection).buttonText), "{} DELIVERY".format(vText)) + + +def main(): + utils.tstStart(__file__) + + startApplication(names.AUT_NAME) + utils.waitForGUI(1) + + # Initial OFF -> Idle/START/UF_True + gotoScreenNtest_Contains_TreatmentHeparinData() + + # it is not working upon user request so there is not rejection + # Initial OFF => BOLUS -> Bolus/HEPARIN + test_state(True, "HEPARIN" , txStates.HEPARIN_STATE_INITIAL_BOLUS ) + + # it is not working upon user request so there is not rejection + # Now BOLUS => DISPENSING -> Dispensing/PAUSE + test_state(True, "PAUSE" , txStates.HEPARIN_STATE_DISPENSING ) + + # Now Dispensing => Paused => Rejected -> Dispensing/PAUSE + test_state(False, "PAUSE" , txStates.HEPARIN_STATE_DISPENSING ) + + # Retry Dispensing => Paused => Rejected -> Dispensing/PAUSE + test_state(False, "PAUSE" , txStates.HEPARIN_STATE_DISPENSING ) + + # Still Dispensing => paused => Accepted -> Paused/RESUME + test_state(True, "RESUME" , txStates.HEPARIN_STATE_PAUSED ) + + # Now Paused => Dispensing => Rejected -> Paused/RESUME + test_state(False, "RESUME" , txStates.HEPARIN_STATE_PAUSED ) + + # Retry Paused => Dispensing => Rejected -> Paused/RESUME + test_state(False, "RESUME" , txStates.HEPARIN_STATE_PAUSED ) + + # Still Paused => Dispensing => Accepted -> Dispensing/PAUSE + test_state(True , "PAUSE" , txStates.HEPARIN_STATE_DISPENSING ) + + # it is not working upon user request so there is not rejection + # Now Dispensing => Complete -> Complete/RESUME + test_state(True, "RESUME" , txStates.HEPARIN_STATE_COMPLETED ) + + # Now Complete => Dispensing => Rejected -> Complete/RESUME + test_state(False, "RESUME" , txStates.HEPARIN_STATE_COMPLETED ) + + # Retry Complete => Dispensing => Rejected -> Complete/RESUME + test_state(False, "RESUME" , txStates.HEPARIN_STATE_COMPLETED ) + + # Still Complete => Dispensing => Accepted -> Dispensing/PAUSE + test_state(True, "PAUSE" , txStates.HEPARIN_STATE_DISPENSING ) + + # it is not working upon user request so there is not rejection + # the dispensing to pause retry tested above and we assume it will deliver until is empty + # Now Dispensing => Empty => -> Dispensing/PAUSE + test_state(True, "HEPARIN" , txStates.HEPARIN_STATE_EMPTY ) + + utils.tstDone()