# -*- 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) 16-Oct-2020 # @author (original) Behrouz NematiPour # @date (original) 01-May-2020 # ############################################################################ import names from dialin.squish import utils, denaliMessages def gotoScreenNtest_Contains_DurationSection(): mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) test.compare(waitForObjectExists(names.o_treatmentStart_shape_Shape).visible, True) def gotoScreenNTest_Adjustment(): mouseClick(waitForObject(names.o_treatmentStart_shape_Shape)) test.compare(waitForObjectExists(names.o_modalDialog).visible, True) def main(): utils.tstStart(__file__) startApplication(names.AUT_NAME) utils.waitForGUI(1) gotoScreenNtest_Contains_DurationSection() utils.waitForGUI(1) denaliMessages.setTreatmentStartState() durationMin = 0 durationMax = 60 * 3 # 3h durationElapsed = 10 # 10m denaliMessages.setTreatmentTime(durationMax * 60 , durationElapsed* 60 ) test.compare(str(waitForObjectExists(names.o_treatmentStart_TimeText_TimeText ).time), "02:50:00") test.compare(str(waitForObjectExists(names.o_treatmentStart_TimeText_hour_Text ).text), "02") test.compare(str(waitForObjectExists(names.o_treatmentStart_TimeText_minute_Text).text), "50") test.compare(str(waitForObjectExists(names.o_treatmentStart_TimeText_second_Text).text), "00") gotoScreenNTest_Adjustment() utils.waitForGUI(1) denaliMessages.setTreatmentParamRanges(durationMin, durationMax, 0, 0, 0, 0) test.compare(waitForObjectExists(names.o_durationSlider_Slider).minimum, durationMin) test.compare(waitForObjectExists(names.o_durationSlider_Slider).maximum, durationMax) durationMin = 10 # 10m durationMax = 60 * 2 # 2h denaliMessages.setTreatmentParamRanges(durationMin, durationMax, 0, 0, 0, 0) test.compare(waitForObjectExists(names.o_durationSlider_Slider).minimum, durationMin) test.compare(waitForObjectExists(names.o_durationSlider_Slider).maximum, durationMax) # the duration dialog should use the same value as the Treatment time test.compare(str(waitForObjectExists(names.o_TimeText_TimeText ).time), "00:10:00") test.compare(str(waitForObjectExists(names.o_TimeText_hour_Text ).text), "00") test.compare(str(waitForObjectExists(names.o_TimeText_minute_Text).text), "10") test.compare(str(waitForObjectExists(names.o_TimeText_second_Text).text), "00") # touch on the middle of the slider mouseClick(waitForObject(names.o_durationSlider_Slider), waitForObjectExists(names.o_durationSlider_Slider).width / 2, 5, Qt.LeftButton) # touch confirm # AdjustDurationReq mouseClick(waitForObjectExists(names.o_confirmButton)) # rejected 65, revert to 75 denaliMessages.sendTreatmentAdjustDurationResponse(0, 4, 75, 0) test.compare(str(waitForObjectExists(names.o_TimeText_hour_Text_2 ).text), "01") test.compare(str(waitForObjectExists(names.o_TimeText_minute_Text_2).text), "15") # rejected 65, revert to 75 # let's see if we got twice with no change do we still act the same denaliMessages.sendTreatmentAdjustDurationResponse(0, 4, 75, 0) test.compare(str(waitForObjectExists(names.o_TimeText_hour_Text_2 ).text), "01") test.compare(str(waitForObjectExists(names.o_TimeText_minute_Text_2).text), "15") test.compare(waitForObjectExists(names.o_modalDialog).visible, True) # accepted denaliMessages.sendTreatmentAdjustDurationResponse(1, 0, 45, 1000) test.compare(waitForObjectExists(names.o_treatmentStart_shape_Shape).visible, True) utils.tstDone()