summaryrefslogtreecommitdiff
path: root/uitest/impress_tests
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/impress_tests')
-rw-r--r--uitest/impress_tests/backgrounds.py30
-rw-r--r--uitest/impress_tests/drawinglayer.py46
2 files changed, 26 insertions, 50 deletions
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py
index 123c7ef81021..1ab001fea91f 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -113,33 +113,27 @@ class ImpressBackgrounds(UITestCase):
buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
for index, button in enumerate(buttons):
- self.ui_test.execute_dialog_through_command(".uno:PageSetup")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageSetup") as xPageSetupDlg:
- xPageSetupDlg = self.xUITest.getTopFocusWindow()
- tabcontrol = xPageSetupDlg.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ tabcontrol = xPageSetupDlg.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xBtn = xPageSetupDlg.getChild(button)
- xBtn.executeAction("CLICK", tuple())
+ xBtn = xPageSetupDlg.getChild(button)
+ xBtn.executeAction("CLICK", tuple())
- # tdf#100024: Without the fix in place, this test would have crashed here
- # changing the background to bitmap
- xOkBtn = xPageSetupDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ # tdf#100024: Without the fix in place, this test would have crashed here
+ # changing the background to bitmap
self.checkDefaultBackground(button)
- self.ui_test.execute_dialog_through_command(".uno:PageSetup")
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:PageSetup") as xPageSetupDlg:
- xPageSetupDlg = self.xUITest.getTopFocusWindow()
- tabcontrol = xPageSetupDlg.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ tabcontrol = xPageSetupDlg.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xBtn = xPageSetupDlg.getChild('btnnone')
- xBtn.executeAction("CLICK", tuple())
+ xBtn = xPageSetupDlg.getChild('btnnone')
+ xBtn.executeAction("CLICK", tuple())
- xOkBtn = xPageSetupDlg.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
self.checkDefaultBackground('btnnone')
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index 7b33e369d2e6..ca09945aeaea 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -44,18 +44,12 @@ class ImpressDrawinglayerTest(UITestCase):
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- self.ui_test.execute_dialog_through_command(".uno:Size")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
- self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
- self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
- self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
-
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Size") as xDialog:
+ self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
xEditWin.executeAction("DESELECT", tuple())
@@ -95,18 +89,12 @@ class ImpressDrawinglayerTest(UITestCase):
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- self.ui_test.execute_dialog_through_command(".uno:Size")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
- self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
- self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
- self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
-
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Size") as xDialog:
+ self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
xEditWin.executeAction("DESELECT", tuple())
@@ -146,14 +134,8 @@ class ImpressDrawinglayerTest(UITestCase):
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- self.ui_test.execute_dialog_through_command(".uno:Size")
-
- xDialog = self.xUITest.getTopFocusWindow()
-
- self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
-
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.execute_dialog_through_command_guarded(".uno:Size") as xDialog:
+ self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
xEditWin.executeAction("DESELECT", tuple())