diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-28 16:52:26 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-29 13:24:54 +0200 |
commit | 279ab35ad07a958b5b8d7d593b9817e7365b9bb5 (patch) | |
tree | 725d143d62d22e1ce9bf44f3f58ef3907f24498f /sc/qa/uitest/pageFormat | |
parent | beeb10a097cdb44af931b92d2849a7e4d09414c0 (diff) |
uitest: guard execute_dialog_through_command in sc
Mostly done with a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: Id49eb66ba2827a6e2d0a737e48726a1d1c49c814
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118029
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/pageFormat')
-rw-r--r-- | sc/qa/uitest/pageFormat/tdf123508.py | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/sc/qa/uitest/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py index c4b8fe9c8431..5b74955c6072 100644 --- a/sc/qa/uitest/pageFormat/tdf123508.py +++ b/sc/qa/uitest/pageFormat/tdf123508.py @@ -20,36 +20,30 @@ class tdf123508(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") #open "Format > Page - Sheet > Scale - self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Scale - scalingMode = xDialog.getChild("comboLB_SCALEMODE") - spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") - spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") - #select "Fit print range(s) to width/height" from the scale mode drop-down list - select_by_text(scalingMode, "Fit print range(s) to width/height") - #define a value for the page, e.g.: width 2; height 2 - spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) - spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) + with self.ui_test.execute_dialog_through_command_guarded(".uno:PageFormatDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Scale + scalingMode = xDialog.getChild("comboLB_SCALEMODE") + spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") + spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") + #select "Fit print range(s) to width/height" from the scale mode drop-down list + select_by_text(scalingMode, "Fit print range(s) to width/height") + #define a value for the page, e.g.: width 2; height 2 + spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) + spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #verify - self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Scale - scalingMode = xDialog.getChild("comboLB_SCALEMODE") - spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") - spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") + with self.ui_test.execute_dialog_through_command_guarded(".uno:PageFormatDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Scale + scalingMode = xDialog.getChild("comboLB_SCALEMODE") + spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") + spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") - self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height") - self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") - self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") + self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: |