# -*- 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_TreatmentSalineBolusData # date 2020/08/10 # author Behrouz NematiPour # # # TreatmentSalineBolusData # o_managerHome_TreatmentSalineBolusData_Target = {"container": o_managerHome, "objectName": "_TreatmentSalineBolusData0", "type": "Text"} # o_managerHome_TreatmentSalineBolusData_Cumulitive = {"container": o_managerHome, "objectName": "_TreatmentSalineBolusData1", "type": "Text"} # o_managerHome_TreatmentSalineBolusData_Delivered = {"container": o_managerHome, "objectName": "_TreatmentSalineBolusData2", "type": "Text"} import names from dialin.squish import utils, denaliMessages def getUnit(): global saline_unit saline_unit = str(waitForObjectExists(names.o_treatmentStart_SalineSection).unit) def gotoScreenNtest_Contains_TreatmentSalineBolusData(): mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineSection).buttonText), "START BOLUS") test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineSection).title ), "SALINE BOLUS") test.compare( waitForObjectExists(names.o_treatmentStart_SalineSection).visible , True) def test_values(vCumulative, vDelivered): test.compare(waitForObjectExists(names.o_treatmentStart_SalineSection).valueCumulative, vCumulative) test.compare(waitForObjectExists(names.o_treatmentStart_SalineSection).valueDelivered , vDelivered ) test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineCumulative).text), "{:.0f}".format(vCumulative)) test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineDelivered ).text), "{:.0f}".format(vDelivered )) def test_target(vTarget): test.compare( waitForObjectExists(names.o_treatmentStart_SalineSection).valueTarget , vTarget ) test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineTarget ).text) , "({:.0f} {})".format(vTarget, saline_unit)) def main(): utils.tstStart(__file__) startApplication(names.AUT_NAME) utils.waitForGUI(1) gotoScreenNtest_Contains_TreatmentSalineBolusData() utils.waitForGUI(1) getUnit() cumulitive = 0 step = 1 for target in [100, 200, 300]: denaliMessages.setTreatmentSalineBolusData(target, 0, 0) test_target(target) for value in range ( 0, target, step): cumulitive += step denaliMessages.setTreatmentSalineBolusData(target, cumulitive, value+1) # 0 is not a step test_values ( cumulitive, value+1) # 0 is not a step denaliMessages.setTreatmentSalineBolusData(200, 110, 10) test_target (200 ) test_values ( 110, 10) denaliMessages.setTreatmentSalineBolusData(200, 110, 10) test_target (200 ) test_values ( 110, 10) denaliMessages.setTreatmentSalineBolusData( 0, 0, 0) test_target ( 0 ) test_values ( 0, 0) utils.tstDone()