Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rac4248de81c547b53e43468fe97135f88d0b78eb -r63d7bdb4228d93b4a4a39f7eff9f1565b4e3a770 --- shared/scripts/configuration/utility.py (.../utility.py) (revision ac4248de81c547b53e43468fe97135f88d0b78eb) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 63d7bdb4228d93b4a4a39f7eff9f1565b4e3a770) @@ -41,7 +41,7 @@ handle the application for log """ test.compare(config.COLOR_CODES[color_name],(act_val.color[name])) - + def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container @@ -225,106 +225,7 @@ test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) test.endSection() -def set_arterial_ranges_min_val(art_low): - """ - Method to set the Arterial range maximum value to user expected value - @param art_low - (int) user expected value - """ - test.startSection("Set Arterial range minimum value to {}".format(art_low)) - arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_min = pyInt(arterial_min.minimum) - arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_max = pyInt(arterial_max.maximum) - low_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) - low_handler_children = object.children(low_handler_parent) - low_handler = low_handler_children[-2] - width = pyInt(low_handler.width) - 8 - height = pyInt(low_handler.height)- 10 - if arterial_min == art_low: - test.passes("Arterial range minimum is already set to {}".format(art_low)) - elif arterial_min < art_low: - while arterial_min != art_low: - squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - arterial_min += 10 - # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg - if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(low_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) - break - else: - continue - elif arterial_min > art_low: - while arterial_min != art_low: - squish.mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - arterial_min -= 10 - # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg - if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(low_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) - break - else: - continue - # arterial blood pressure low limit should be lower than the high limit by atleast 30mmHg - if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: - test.compare(low_handler_parent.minValue, arterial_min, "Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) - else: - test.compare(arterial_min, art_low, "Actual Arterial range minimum value: {} is equal to Expected value: {}".format(arterial_min, art_low)) - test.endSection() - -def set_arterial_ranges_max_val(art_high): - """ - Method to set the Arterial range maximum value to user expected value - @param art_high - (int) user expected value - """ - test.startSection("Set Arterial range maximum value to {}".format(art_high)) - arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_max = pyInt(arterial_max.maximum) - arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) - arterial_min = pyInt(arterial_min.minimum) - high_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) - high_handler_children = object.children(high_handler_parent) - high_handler = high_handler_children[-1] - width = pyInt(high_handler.width) - 20 - height = pyInt(high_handler.height) - 25 - if arterial_max == art_high: - test.passes("Arterial range maximum is already set to {}".format(art_high)) - elif arterial_max < art_high: - while arterial_max != art_high: - squish.mouseDrag(high_handler, -1, height, width, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) - arterial_max += 10 - # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg - if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) - break - else: - continue - elif arterial_max > art_high: - while arterial_max != art_high: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - arterial_max -= 10 - # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg - if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - squish.mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) - break - else: - continue - # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg - if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: - test.compare(high_handler_parent.maxValue, arterial_max, - "Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) - else: - test.compare(arterial_max, art_high, - "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) - test.endSection() - def set_venous_ranges_max_val(ven_high): """ Method to set the Venous range maximum value to user expected value @@ -498,10 +399,7 @@ consumables_self_test_state=0, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) -======= ->>>>>>> create_custom_treatment - def convert_seconds_into_min_and_sec(seconds): min_and_sec = time.strftime("%M:%S", time.gmtime(seconds)) return min_and_sec @@ -635,7 +533,107 @@ test.passes("object is not present as expected") squish.testSettings.objectNotFoundDebugging = True + +def set_arterial_ranges_min_val(art_low): + """ + Method to set the Arterial range maximum value to user expected value + @param art_low - (int) user expected value + """ + test.startSection("Set Arterial range minimum value to {}".format(art_low)) + arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) + arterial_min = pyInt(arterial_min.minimum) + arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) + arterial_max = pyInt(arterial_max.maximum) + low_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) + low_handler_children = object.children(low_handler_parent) + low_handler = low_handler_children[-2] + width = pyInt(low_handler.width) - 8 + height = pyInt(low_handler.height)- 10 + if arterial_min == art_low: + test.passes("Arterial range minimum is already set to {}".format(art_low)) + elif arterial_min < art_low: + while arterial_min != art_low: + squish.mouseDrag(low_handler, width, height, 1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_min += 10 + # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: + squish.mouseDrag(low_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) + break + else: + continue + elif arterial_min > art_low: + while arterial_min != art_low: + squish.mouseDrag(low_handler, width, height, -1, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_min -= 10 + # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: + squish.mouseDrag(low_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) + break + else: + continue + # arterial blood pressure low limit should be lower than the high limit by atleast 30mmHg + if arterial_min == arterial_max - config.BUFFER_LOW_AND_HIGH_LIMITS: + test.compare(low_handler_parent.minValue, arterial_min, "Arterial range minimum value cannot be moved beyond {}".format(arterial_min)) + else: + test.compare(arterial_min, art_low, "Actual Arterial range minimum value: {} is equal to Expected value: {}".format(arterial_min, art_low)) + test.endSection() + +def set_arterial_ranges_max_val(art_high): + """ + Method to set the Arterial range maximum value to user expected value + @param art_high - (int) user expected value + """ + test.startSection("Set Arterial range maximum value to {}".format(art_high)) + arterial_max = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) + arterial_max = pyInt(arterial_max.maximum) + arterial_min = squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery) + arterial_min = pyInt(arterial_min.minimum) + high_handler_parent = object.parent(squish.waitForObjectExists(names.o_PreTreatmentCreate_rangeRect_RangeRect_Artery)) + high_handler_children = object.children(high_handler_parent) + high_handler = high_handler_children[-1] + width = pyInt(high_handler.width) - 20 + height = pyInt(high_handler.height) - 25 + if arterial_max == art_high: + test.passes("Arterial range maximum is already set to {}".format(art_high)) + elif arterial_max < art_high: + while arterial_max != art_high: + squish.mouseDrag(high_handler, -1, height, width, 0, squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_max += 10 + # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: + squish.mouseDrag(high_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) + break + else: + continue + elif arterial_max > art_high: + while arterial_max != art_high: + squish.mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_max -= 10 + # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: + squish.mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) + break + else: + continue + # arterial blood pressure low limit should be lower than the high limit by at least 30mmHg + if arterial_max == arterial_min + config.BUFFER_LOW_AND_HIGH_LIMITS: + test.compare(high_handler_parent.maxValue, arterial_max, + "Arterial range maximum value cannot be moved beyond {}".format(arterial_max)) + else: + test.compare(arterial_max, art_high, + "Actual Arterial range maximum value: {} is equal to Expected value: {}".format(arterial_max, art_high)) + test.endSection() + def get_text_object(screen_obj, txt): """ To obtain a text object based on text provided