## # 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_Alarm # date 2020/06/26 # author Peter Lucia # import names from dialin.ui import utils from dialin import HDSimulator from dialin.ui.hd_simulator_alarms import Alarms from dialin.utils.conversions import integer_to_bit_array def test_flags(hd_simulator: HDSimulator): """ Tests the alarm flags @param hd_simulatr: The HDSimulator object @returns: None """ params = { "system_fault": 0, "stop": 0, "no_clear": 0, "no_resume": 0, "no_rinseback": 0, "no_end_treatment": 0, "no_new_treatment": 0, "user_must_ack": 0, "alarms_to_escalate": 0, "alarms_silenced": 0, "lamp_on": 0, "unused_1": 0, "unused_2": 0, "unused_3": 0, "unused_4": 0, "top_condition": 0 } num_bits = 4 for number in range(2**num_bits): bits = integer_to_bit_array(number, num_bits) params["no_resume"] = bits[0] params["no_rinseback"] = bits[1] params["no_end_treatment"] = bits[2] params["user_must_ack"] = bits[3] test.log("Flags", "{0}".format(bits)) flags = hd_simulator.alarms_simulator.cmd_make_alarm_flags(**params) hd_simulator.alarms_simulator.cmd_activate_alarm_id(Alarms.ALARM_ID_SOFTWARE_FAULT[0], Alarms.ALARM_ID_SOFTWARE_FAULT[1], Alarms.ALARM_ID_SOFTWARE_FAULT[2], Alarms.ALARM_ID_SOFTWARE_FAULT[3], flags) if params["user_must_ack"]: test.compare(waitForObject(names.o_okay_alarm).visible, True) mouseClick(names.o_okay_alarm) if not params["no_resume"]: test.compare(waitForObject(names.o_alarm_resume).visible, True) mouseClick(names.o_alarm_resume) if not params["no_rinseback"]: test.compare(waitForObject(names.o_alarm_rinseback).visible, True) mouseClick(names.o_alarm_rinseback) if not params["no_end_treatment"]: test.compare(waitForObject(names.o_alarm_end).visible, True) mouseClick(names.o_alarm_end) hd_simulator.alarms_simulator.cmd_send_clear_alarms() def main(): """ Main function to test the alarm flags. @return: None """ utils.tstStart(__file__) startApplication(names.AUT_NAME + " -q") hd_simulator = HDSimulator() test_flags(hd_simulator) utils.tstDone()