Index: shared/scripts/names.py =================================================================== diff -u -r9fb8abff0916942c7d80874b27c1729c5373c12b -r3875e7eedf54949d63d04e8c88b34e76d02d31ed --- shared/scripts/names.py (.../names.py) (revision 9fb8abff0916942c7d80874b27c1729c5373c12b) +++ shared/scripts/names.py (.../names.py) (revision 3875e7eedf54949d63d04e8c88b34e76d02d31ed) @@ -74,8 +74,7 @@ o_arterial_left_slider = {"container": o_arterial_slider, "gradient": 0, "id": "_handlerLeft", "type": "Rectangle", "unnamed": 1, "visible": True} o_arterial_right_slider = {"container": o_Overlay, "gradient": 0, "id": "_handlerRight", "type": "Rectangle", "unnamed": 1, "visible": True} o_arterial_text_low = {"container": o_Overlay, "text": "LOW", "type": "Text", "unnamed": 1, "visible": True} -o_arterial_max_val = {"container": o_arterial_limitbar, "id": "_textMaximum", "type": "Text", "unnamed": 1, "visible": True} -o_arterial_min_val = {"container": o_arterial_limitbar, "id": "_textMinimum", "type": "Text", "unnamed": 1, "visible": True} +o_venous_text_low = {"container": o_Overlay, "occurrence": 2, "text": "LOW", "type": "Text", "unnamed": 1, "visible": True} def pressure_pop_up_text_obj(text): o_pop_up_pressure_text_obj["text"] = text Index: tst_main_treatment_pressure/test.py =================================================================== diff -u -r9fb8abff0916942c7d80874b27c1729c5373c12b -r3875e7eedf54949d63d04e8c88b34e76d02d31ed --- tst_main_treatment_pressure/test.py (.../test.py) (revision 9fb8abff0916942c7d80874b27c1729c5373c12b) +++ tst_main_treatment_pressure/test.py (.../test.py) (revision 3875e7eedf54949d63d04e8c88b34e76d02d31ed) @@ -18,6 +18,7 @@ from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator +from reportlab.graphics.samples.excelcolors import color10Light in_range_color = "#ffffff" @@ -38,6 +39,12 @@ VENOUS_HIGH_VAL_300 = 300 VENOUS_LOW_VAL_110 = 110 VENOUS_HIGH_VAL_250 = 250 +VAL_MINUS_100 = -100 +VAL_MINUS_250 = -250 +VAL_MINUS_120 = -120 +VAL_MINUS_270 = -270 +VAL_MINUS_300 = -300 +VAL_0 = 0 hd = HDSimulator() @@ -138,30 +145,54 @@ test.startSection("Set Arterial range minimum value " + "to {val}".format(val=art_low)) arterial_min = waitForObjectExists(names.o_arterial_limitbar) - arterial_min_val = pyInt(arterial_min.minimum) + arterial_min = pyInt(arterial_min.minimum) + arterial_max = waitForObjectExists(names.o_arterial_limitbar) + arterial_max = pyInt(arterial_max.maximum) low_handler_parent = object.parent(\ waitForObjectExists(names.o_arterial_text_low)) low_handler_children = object.children(low_handler_parent) low_handler = low_handler_children[-2] width = pyInt(low_handler.width) height = pyInt(low_handler.height) - width = width + 15 - height = height + 10 - if arterial_min_val == art_low: + width = width - 15 + height = height - 10 + if arterial_min == art_low: test.passes("Arterial range minimum is already set to " + "{minimum}".format(minimum=art_low)) - elif arterial_min_val < art_low: - while waitFor("arterial_min.minimum != art_low"): + elif arterial_min < art_low: + while arterial_min != art_low: mouseDrag(low_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - elif arterial_min_val > art_low: - while waitFor("arterial_min.minimum != art_low"): - mouseDrag(low_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) - test.compare(arterial_min_val, art_low, - "Actual Arterial range minimum value: " + - "{min_range} is ".format(min_range=arterial_min_val) + - "equal to Expected value: {exp}".format(exp=art_low)) + squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_min += 10 + if arterial_min == arterial_max - 30: + mouseDrag(low_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range minimum value cannot be " + + "moved beyond {min}".format(min=arterial_min)) + break + else: + continue + elif arterial_min > art_low: + while arterial_min != art_low: + mouseDrag(low_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + arterial_min -= 10 + if arterial_min == arterial_max - 30: + mouseDrag(low_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range minimum value cannot be " + + "moved beyond {min}".format(min=arterial_min)) + break + else: + continue + if arterial_min == arterial_max - 30: + test.passes("Arterial range minimum value cannot be " + + "moved beyond {min}".format(min=arterial_min)) + else: + test.compare(arterial_min, art_low, + "Actual Arterial range minimum value: " + + "{min_range} is ".format(min_range=arterial_min) + + "equal to Expected value: {exp}".format(exp=art_low)) test.endSection() @@ -175,6 +206,8 @@ "to {val}".format(val=art_high)) arterial_max = waitForObjectExists(names.o_arterial_limitbar) arterial_max = pyInt(arterial_max.maximum) + arterial_min = waitForObjectExists(names.o_arterial_limitbar) + arterial_min = pyInt(arterial_min.minimum) high_handler_parent = object.parent(\ waitForObjectExists(names.o_arterial_text_low)) high_handler_children = object.children(high_handler_parent) @@ -189,29 +222,214 @@ elif arterial_max < art_high: while arterial_max != art_high: mouseDrag(high_handler, width, height, 1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_max += 10 + if arterial_max == arterial_min + 30: + mouseDrag(high_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range maximum value cannot be " + + "moved beyond {max}".format(max=arterial_max)) + break + else: + continue elif arterial_max > art_high: while arterial_max != art_high: - mouseDrag(high_handler, width, height, -1, 0, - squish.Qt.NoModifier, squish.Qt.LeftButton) + mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) arterial_max -= 10 - test.compare(arterial_max, art_high, - "Actual Arterial range maximum value: " + - "{max_range} is ".format(max_range=arterial_max) + - "equal to Expected value: {exp}".format(exp=art_high)) + if arterial_max == arterial_min + 30: + mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Arterial range maximum value cannot be " + + "moved beyond {max}".format(max=arterial_max)) + break + else: + continue + if arterial_max == arterial_min + 30: + test.passes("Arterial range maximum value cannot be " + + "moved beyond {max}".format(max=arterial_max)) + else: + test.compare(arterial_max, art_high, + "Actual Arterial range maximum value: " + + "{max_range} is ".format(max_range=arterial_max) + + "equal to Expected value: {exp}".format(exp=art_high)) test.endSection() +def set_venous_ranges_min_val(ven_low): + """ + Method to set the Venous range + maximum value to user expected value + @param ven_low - user expected value + """ + test.startSection("Set Venous range minimum value " + + "to {val}".format(val=ven_low)) + ven_min = waitForObjectExists(names.o_venous_limitbar) + ven_min = pyInt(ven_min.minimum) + ven_max = waitForObjectExists(names.o_venous_limitbar) + ven_max = pyInt(ven_max.maximum) + low_handler_parent = object.parent(\ + waitForObjectExists(names.o_venous_text_low)) + low_handler_children = object.children(low_handler_parent) + low_handler = low_handler_children[-2] + width = pyInt(low_handler.width) + height = pyInt(low_handler.height) + width = width - 15 + height = height - 10 + if ven_min == ven_low: + test.passes("Venous range minimum is already set to " + + "{minimum}".format(minimum=ven_low)) + elif ven_min < ven_low: + while ven_min != ven_low: + mouseDrag(low_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + ven_min += 10 + if ven_min == ven_max - 30: + mouseDrag(low_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Venous range minimum value cannot be " + + "moved beyond {min}".format(min=ven_min)) + break + else: + continue + elif ven_min > ven_low: + while ven_min != ven_low: + mouseDrag(low_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + ven_min -= 10 + if ven_min == ven_max - 30: + mouseDrag(low_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Venous range minimum value cannot be " + + "moved beyond {min}".format(min=ven_min)) + break + else: + continue + if ven_min == ven_max - 30: + test.passes("Venous range minimum value cannot be " + + "moved beyond {min}".format(min=ven_min)) + else: + test.compare(ven_min, ven_low, + "Actual Venous range minimum value: " + + "{min_range} is ".format(min_range=ven_min) + + "equal to Expected value: {exp}".format(exp=ven_low)) + test.endSection() + + +def set_venous_ranges_max_val(ven_high): + """ + Method to set the Venous range + maximum value to user expected value + @param art_high - user expected value + """ + test.startSection("Set Venous range maximum value " + + "to {val}".format(val=ven_high)) + ven_max = waitForObjectExists(names.o_venous_limitbar) + ven_max = pyInt(ven_max.maximum) + ven_min = waitForObjectExists(names.o_venous_limitbar) + ven_min = pyInt(ven_min.minimum) + high_handler_parent = object.parent(\ + waitForObjectExists(names.o_venous_text_low)) + high_handler_children = object.children(high_handler_parent) + high_handler = high_handler_children[-1] + width = pyInt(high_handler.width) + height = pyInt(high_handler.height) + width = width - 15 + height = height - 10 + if ven_max == ven_high: + test.passes("Venous range maximum is already set to " + + "{maximum}".format(maximum=ven_high)) + elif ven_max < ven_high: + while ven_max != ven_high: + mouseDrag(high_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + ven_max += 10 + if ven_max == ven_min + 30: + mouseDrag(high_handler, width, height, 1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Venous range maximum value cannot be " + + "moved beyond {max}".format(max=ven_max)) + break + else: + continue + elif ven_max > ven_high: + while ven_max != ven_high: + mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + ven_max -= 10 + if ven_max == ven_min + 30: + mouseDrag(high_handler, width, height, -1, 0, + squish.Qt.NoModifier, squish.Qt.LeftButton) + test.log("Venous range maximum value cannot be " + + "moved beyond {max}".format(max=ven_max)) + break + else: + continue + if ven_max == ven_min + 30: + test.passes("Venous range maximum value cannot be " + + "moved beyond {max}".format(max=ven_max)) + else: + test.compare(ven_max, ven_high, + "Actual Venous range maximum value: " + + "{max_range} is ".format(max_range=ven_max) + + "equal to Expected value: {exp}".format(exp=ven_high)) + test.endSection() + + def set_arterial_low_and_high_limits_using_slider(): + """ + Method to set the arterial low and + high limits using slider + """ + test.startSection("Set the arterial low and " + + "high limits using slider") open_pressure_pop_up() - set_arterial_ranges_max_val(art_high=-100) - set_arterial_ranges_min_val(art_low=-250) - set_arterial_ranges_max_val(art_high=-10) - set_arterial_ranges_min_val(art_low=-120) - set_arterial_ranges_max_val(art_high=0) - set_arterial_ranges_min_val(art_low=-300) + utils.waitForGUI(1) + set_arterial_ranges_max_val(art_high=VAL_MINUS_100) + utils.waitForGUI(1) + set_arterial_ranges_min_val(art_low=VAL_MINUS_250) + utils.waitForGUI(1) + set_arterial_ranges_max_val(art_high=VAL_MINUS_250) + utils.waitForGUI(1) + set_arterial_ranges_max_val(art_high=VAL_MINUS_120) + utils.waitForGUI(1) + set_arterial_ranges_min_val(art_low=VAL_MINUS_270) + utils.waitForGUI(1) + set_arterial_ranges_min_val(art_low=VAL_MINUS_120) + utils.waitForGUI(1) + set_arterial_ranges_min_val(art_low=VAL_MINUS_300) + utils.waitForGUI(1) + set_arterial_ranges_max_val(art_high=VAL_0) close_the_pop_up() + test.endSection() + + +def set_venous_low_and_high_limits_using_slider(): + """ + Method to set the venous low and + high limits using slider + """ + test.startSection("Set the venous low and " + + "high limits using slider") + open_pressure_pop_up() + utils.waitForGUI(1) + set_venous_ranges_max_val(ven_high=500) + utils.waitForGUI(1) + set_venous_ranges_min_val(ven_low=500) + utils.waitForGUI(1) + set_venous_ranges_min_val(ven_low=50) + utils.waitForGUI(1) + set_venous_ranges_max_val(ven_high=200) + utils.waitForGUI(1) + set_venous_ranges_max_val(ven_high=450) + utils.waitForGUI(1) + set_venous_ranges_min_val(ven_low=450) + utils.waitForGUI(1) + set_venous_ranges_min_val(ven_low=20) + utils.waitForGUI(1) + set_venous_ranges_max_val(ven_high=600) + close_the_pop_up() + test.endSection() def verify_arterial_and_venous_value_on_pressure_pop_up(accepted, reason_id, @@ -481,6 +699,7 @@ verify_the_constants() set_arterial_low_and_high_limits_using_slider() + set_venous_low_and_high_limits_using_slider() set_arterial_pressure_and_verify_the_color() set_venous_pressure_and_verify_the_color()