# -*- coding: utf-8 -*- ## # 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_Treatment_Adjustment_Duration # date 2020/04/28 # author Behrouz NematiPour # 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(): startApplication("denaliSquish") utils.tstStart() utils.waitForGUI(1) gotoScreenNtest_Contains_DurationSection() utils.waitForGUI(1) 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()