Index: shared/scripts/configuration/config.py =================================================================== diff -u -reeeeccc9e75d0c7c894e744aa44b82e1e174d345 -re09e4bf9ba04efde15f93efc8766d2abcaedc4cb --- shared/scripts/configuration/config.py (.../config.py) (revision eeeeccc9e75d0c7c894e744aa44b82e1e174d345) +++ shared/scripts/configuration/config.py (.../config.py) (revision e09e4bf9ba04efde15f93efc8766d2abcaedc4cb) @@ -72,6 +72,11 @@ } +BRIGHTNESS_MIN_VAL = 20 +BRIGHTNESS_MAX_VAL = 100 +VOLUME_MIN_VAL = 20 +VOLUME_MAX_VAL = 100 +UNIT_OF_VOLUME_AND_BRIGHTNESS = "%" @@ -83,3 +88,5 @@ + + Index: shared/scripts/names.py =================================================================== diff -u -reeeeccc9e75d0c7c894e744aa44b82e1e174d345 -re09e4bf9ba04efde15f93efc8766d2abcaedc4cb --- shared/scripts/names.py (.../names.py) (revision eeeeccc9e75d0c7c894e744aa44b82e1e174d345) +++ shared/scripts/names.py (.../names.py) (revision e09e4bf9ba04efde15f93efc8766d2abcaedc4cb) @@ -5,6 +5,15 @@ from objectmaphelper import * +# Top Parents +o_QQuickView = { "type": "QQuickView"} +o_Overlay = {"container": o_QQuickView, "type": "Overlay"} +o_treatmentHome = {"container": o_QQuickView , "id": "_treatmentHome" , "type": "TreatmentHome", "unnamed": 1, "visible": True} +o_treatmentHome_backgroung = {"container": o_treatmentHome, "id": "_backgroundRect" , "type": "Rectangle" , "unnamed": 1, "visible": True} +o_treatmentHome_startTreatment = {"container": o_treatmentHome, "id": "_startTreatmentRect" , "type": "TouchRect" , "unnamed": 1, "visible": True} +o_treatmentHome_createTreatment = {"container": o_treatmentHome, "id": "_createTreatmentRect", "type": "TouchRect" , "unnamed": 1, "visible": True} + + o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} o_Overlay = {"container": o_Gui_MainView, "type": "Overlay", "unnamed": 1, "visible": True} o_borderRect_Rectangle = {"container": o_Overlay, "gradient": 0, "id": "_borderRect", "type": "Rectangle", "unnamed": 1, "visible": True} @@ -62,4 +71,7 @@ #volume and brightness o_SettingsBase_SettingsVolumeBrightness = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsVolumeBrightness", "visible": True} -o_SettingsBase_Volume_And_Brightness_Text = {"container": o_SettingsBase_SettingsVolumeBrightness, "type": "Text", "unnamed": 1, "visible": True} \ No newline at end of file +o_SettingsBase_Volume_And_Brightness_Text = {"container": o_SettingsBase_SettingsVolumeBrightness, "type": "Text", "unnamed": 1, "visible": True} +o_brightness_parent_obj = {"container": o_SettingsBase_SettingsVolumeBrightness, "gradient": 0, "id": "_brightness", "type": "Slider", "unnamed": 1, "visible": True} + + Index: tst_settings_information/test.py =================================================================== diff -u -reeeeccc9e75d0c7c894e744aa44b82e1e174d345 -re09e4bf9ba04efde15f93efc8766d2abcaedc4cb --- tst_settings_information/test.py (.../test.py) (revision eeeeccc9e75d0c7c894e744aa44b82e1e174d345) +++ tst_settings_information/test.py (.../test.py) (revision e09e4bf9ba04efde15f93efc8766d2abcaedc4cb) @@ -18,11 +18,13 @@ from configuration import config, utility from dialin.common.msg_ids import MsgIds from dialin.common import msg_defs +from builtins import int as pyInt from dialin.utils.conversions import unsigned_integer_to_bytearray from dialin.ui.hd_simulator import HDSimulator from dialin.ui.dg_simulator import DGSimulator from dialin.common.hd_defs import HDOpModes from dialin.ui import utils +from configuration.config import ALARM_VOLUME_TEXT hd_simulator = HDSimulator() dg_simulator = DGSimulator() @@ -48,6 +50,9 @@ FIRST_PARAMETER_OBJECT_ITEM_POSITION_2 = 2 TITLE_ITEM_OBJECT_POSIITON_1 = 1 VERSION_ITEM_OBJECT_POSTION_3 = 3 +BRIGHTNESS_BUFFER = 20 +VOLUME_BUFFER = 20 +VOLUME_RANGE = [80, 40, 20, 100, 60] def settings_text_obj(text): names.o_settings_home_text_obj["text"] = text @@ -257,21 +262,64 @@ test.compare(alarm_volume_text.text, config.ALARM_VOLUME_TEXT,"Alarm Volume text should be {}".format(config.ALARM_VOLUME_TEXT)) back_btn = waitForObjectExists(volume_and_brightness_text_obj(config.BACK_TEXT)) test.compare(back_btn.enabled , True, "Back button should be enabled") + utils.waitForGUI(0.5) mouseClick(back_btn) utils.waitForGUI(0.5) mouseClick(waitForObjectExists(settings_text_obj(config.VOLUME_AND_BRIGHTNESS_TEXT))) + utils.waitForGUI(1) test.endSection() -def verify_brightness_and_alarm_volume_values(): +def adjust_and_verify_alarm_volume(volume): """ - Method to verify "Alarm Volume and Brightness slider values" on screen + Method to set the Alarm volume and verify the + same + @param volume - (int) User expected Alarm volume """ - test.startSection("Verifying brightness and alarm volume slider values") - utils.waitForGUI(1) - for brightness in config.CREATE_TREATMENT_PARAMETER_RANGE[config.BRIGHTNESS_TEXT]: - test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, brightness, config.VOLUME_AND_BRIGHTNESS_SLIDER_VALUES["Brightness"], config.BRIGHTNESS_TEXT) - test.endSection() + test.startSection("Set the Alarm Volume to {} and verify the current volume is {}".format(volume, volume)) + alarm_volume_text = waitForObjectExists(volume_and_brightness_text_obj(config.ALARM_VOLUME_TEXT)) + row_obj = object.parent(alarm_volume_text) + alarm_volume_parent_object_index = 1 + alarm_volume_parent_obj = object.children(row_obj) + alarm_volume_parent_obj = alarm_volume_parent_obj[alarm_volume_parent_object_index] + alarm_volume_parent_object = object.children(alarm_volume_parent_obj) + MINIMUM_TEXT_INDEX = 0 + MAXIMUM_TEXT_INDEX = 1 + SLIDER_INDEX = -1 + PROGRESS_OBJ_INDEX = 3 + minimum_alarm_volume_value = alarm_volume_parent_object[MINIMUM_TEXT_INDEX] + minimum_alarm_volume_value = minimum_alarm_volume_value.text + maximum_alarm_volume_value = alarm_volume_parent_object[MAXIMUM_TEXT_INDEX] + maximum_alarm_volume_value = maximum_alarm_volume_value.text + slider_obj = alarm_volume_parent_object[SLIDER_INDEX] + progress_parent = alarm_volume_parent_object[PROGRESS_OBJ_INDEX] + progress_children = object.children(progress_parent) + current_alarm_volume = progress_children[1] + current_alarm_volume_val = builtins.int(str(current_alarm_volume.text)) + width = pyInt(slider_obj.width) - 10 + height = pyInt(slider_obj.height) - 20 + if volume == current_alarm_volume_val: + test.passes("Alarm volume value is already set to {}".format(volume)) + elif volume < current_alarm_volume_val: + while current_alarm_volume_val != volume: + mouseDrag(slider_obj, -100, height, width, 0, Qt.NoModifier, Qt.LeftButton) + current_alarm_volume_val -= VOLUME_BUFFER + elif volume > current_alarm_volume_val: + while current_alarm_volume_val != volume: + mouseDrag(slider_obj, 50, height, width, 0, Qt.NoModifier, Qt.LeftButton) + current_alarm_volume_val += VOLUME_BUFFER + expected_alarm_volume = "{}{}".format(volume, config.UNIT_OF_VOLUME_AND_BRIGHTNESS) + current_alarm_volume = progress_children[1] + current_alarm_volume_val = "{}{}".format(current_alarm_volume.text, config.UNIT_OF_VOLUME_AND_BRIGHTNESS) + test.compare(current_alarm_volume_val, expected_alarm_volume, "Current Alarm volume should be {}".format(expected_alarm_volume)) + test.endSection() +def verify_alarm_volume(): + """ + Method to loop through different alarm volume + values and set the alarm volume in UI + """ + for volume in VOLUME_RANGE: + adjust_and_verify_alarm_volume(volume) def main(): @@ -323,5 +371,8 @@ test.log("Navigating to 'Volume and Brightness' screen") mouseClick(waitForObjectExists(settings_text_obj(config.VOLUME_AND_BRIGHTNESS_TEXT))) verify_volume_and_brightness_section() + + verify_alarm_volume() + utils.tstDone() \ No newline at end of file