# -*- coding: utf-8 -*- ########################################################################### # # Copyright (c) 2020-2025 Diality Inc. - All Rights Reserved. # # 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 test.py # # @author (last) Behrouz NematiPour # @date (last) 24-Nov-2020 # @author (original) Behrouz NematiPour # @date (original) 10-Aug-2020 # ############################################################################ 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()