summaryrefslogtreecommitdiff
path: root/uitest/impress_tests
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-22 11:17:29 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-22 21:47:11 +0200
commit374baf308979306aa35575118c40ccd7caae1e29 (patch)
tree2570881a42fe5b5555db1dbf2aecc0a3fdd33878 /uitest/impress_tests
parentb2331179fc508fd6bc37355e5c3c5a5ee54557c4 (diff)
uitest: guard create_doc_in_start_center
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I75ef7712af3676363a9a464acf83f6f68ffc4f85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117617 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest/impress_tests')
-rw-r--r--uitest/impress_tests/backgrounds.py54
-rw-r--r--uitest/impress_tests/drawinglayer.py198
-rw-r--r--uitest/impress_tests/layouts.py42
-rw-r--r--uitest/impress_tests/start.py42
4 files changed, 161 insertions, 175 deletions
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py
index 123c7ef81021..a98e8a33f71c 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -105,44 +105,42 @@ class ImpressBackgrounds(UITestCase):
def test_background_dialog(self):
- self.ui_test.create_doc_in_start_center("impress")
+ with self.ui_test.create_doc_in_start_center("impress"):
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
- for index, button in enumerate(buttons):
- self.ui_test.execute_dialog_through_command(".uno:PageSetup")
+ buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
+ for index, button in enumerate(buttons):
+ self.ui_test.execute_dialog_through_command(".uno:PageSetup")
- xPageSetupDlg = self.xUITest.getTopFocusWindow()
- tabcontrol = xPageSetupDlg.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ xPageSetupDlg = self.xUITest.getTopFocusWindow()
+ 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
+ xOkBtn = xPageSetupDlg.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.checkDefaultBackground(button)
+ self.checkDefaultBackground(button)
- self.ui_test.execute_dialog_through_command(".uno:PageSetup")
+ self.ui_test.execute_dialog_through_command(".uno:PageSetup")
- xPageSetupDlg = self.xUITest.getTopFocusWindow()
- tabcontrol = xPageSetupDlg.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ xPageSetupDlg = self.xUITest.getTopFocusWindow()
+ 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())
+ xOkBtn = xPageSetupDlg.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.checkDefaultBackground('btnnone')
-
- self.ui_test.close_doc()
+ self.checkDefaultBackground('btnnone')
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index 7b33e369d2e6..4e2f33d45604 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -13,152 +13,146 @@ from uitest.framework import UITestCase
class ImpressDrawinglayerTest(UITestCase):
def test_move_object(self):
- self.ui_test.create_doc_in_start_center("impress")
+ with self.ui_test.create_doc_in_start_center("impress"):
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- change_measurement_unit(self, 'Centimeter')
+ change_measurement_unit(self, 'Centimeter')
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
- self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
- self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X)
- self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y)
+ document = self.ui_test.get_component()
+ self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
+ self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
+ self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X)
+ self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y)
- xEditWin = xImpressDoc.getChild("impress_win")
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"}))
+ xEditWin = xImpressDoc.getChild("impress_win")
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"}))
- self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
- self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
- self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X)
- self.assertEqual(4685, document.DrawPages[0].getByIndex(1).Position.Y)
+ self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
+ self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
+ self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X)
+ self.assertEqual(4685, document.DrawPages[0].getByIndex(1).Position.Y)
- self.assertIsNone(document.CurrentSelection)
+ self.assertIsNone(document.CurrentSelection)
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
- self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ 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")
+ self.ui_test.execute_dialog_through_command(".uno:Size")
- xDialog = self.xUITest.getTopFocusWindow()
+ 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'])
+ 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)
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- xEditWin.executeAction("DESELECT", tuple())
- self.assertIsNone(document.CurrentSelection)
-
- self.ui_test.close_doc()
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
def test_resize_object(self):
- self.ui_test.create_doc_in_start_center("impress")
-
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.create_doc_in_start_center("impress"):
- change_measurement_unit(self, 'Centimeter')
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ change_measurement_unit(self, 'Centimeter')
- document = self.ui_test.get_component()
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xImpressDoc.getChild("impress_win")
+ document = self.ui_test.get_component()
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
+ self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
+ self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
+ xEditWin = xImpressDoc.getChild("impress_win")
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height)
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
- self.assertIsNone(document.CurrentSelection)
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
+ self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
+ self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width)
+ self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height)
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
- self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ self.assertIsNone(document.CurrentSelection)
- self.ui_test.execute_dialog_through_command(".uno:Size")
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:Size")
- 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'])
+ xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ 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())
- self.assertIsNone(document.CurrentSelection)
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- self.ui_test.close_doc()
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
def test_rotate_object(self):
- self.ui_test.create_doc_in_start_center("impress")
-
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.create_doc_in_start_center("impress"):
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- document = self.ui_test.get_component()
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
- self.assertEqual(0, document.DrawPages[0].getByIndex(1).RotateAngle)
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xImpressDoc.getChild("impress_win")
+ document = self.ui_test.get_component()
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
+ self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
+ self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
+ self.assertEqual(0, document.DrawPages[0].getByIndex(1).RotateAngle)
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"}))
+ xEditWin = xImpressDoc.getChild("impress_win")
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
- self.assertEqual(3000, document.DrawPages[0].getByIndex(1).RotateAngle)
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"}))
- self.assertIsNone(document.CurrentSelection)
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
+ self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
+ self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
+ self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)
+ self.assertEqual(3000, document.DrawPages[0].getByIndex(1).RotateAngle)
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
- self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ self.assertIsNone(document.CurrentSelection)
- self.ui_test.execute_dialog_through_command(".uno:Size")
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:Size")
- self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+ xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ 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())
- self.assertIsNone(document.CurrentSelection)
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- self.ui_test.close_doc()
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/layouts.py b/uitest/impress_tests/layouts.py
index ebbe8e2ec266..f18321e4d076 100644
--- a/uitest/impress_tests/layouts.py
+++ b/uitest/impress_tests/layouts.py
@@ -11,33 +11,31 @@ class ImpressLayouts(UITestCase):
def test_impress_layouts(self):
- self.ui_test.create_doc_in_start_center("impress")
+ with self.ui_test.create_doc_in_start_center("impress"):
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- layouts= (".uno:AssignLayout?WhatLayout:long=20", ".uno:AssignLayout?WhatLayout:long=19",
- ".uno:AssignLayout?WhatLayout:long=0", ".uno:AssignLayout?WhatLayout:long=1",
- ".uno:AssignLayout?WhatLayout:long=32", ".uno:AssignLayout?WhatLayout:long=3",
- ".uno:AssignLayout?WhatLayout:long=12", ".uno:AssignLayout?WhatLayout:long=15",
- ".uno:AssignLayout?WhatLayout:long=14", ".uno:AssignLayout?WhatLayout:long=16",
- ".uno:AssignLayout?WhatLayout:long=18", ".uno:AssignLayout?WhatLayout:long=34",
- ".uno:AssignLayout?WhatLayout:long=28", ".uno:AssignLayout?WhatLayout:long=27",
- ".uno:AssignLayout?WhatLayout:long=29", ".uno:AssignLayout?WhatLayout:long=30")
+ layouts= (".uno:AssignLayout?WhatLayout:long=20", ".uno:AssignLayout?WhatLayout:long=19",
+ ".uno:AssignLayout?WhatLayout:long=0", ".uno:AssignLayout?WhatLayout:long=1",
+ ".uno:AssignLayout?WhatLayout:long=32", ".uno:AssignLayout?WhatLayout:long=3",
+ ".uno:AssignLayout?WhatLayout:long=12", ".uno:AssignLayout?WhatLayout:long=15",
+ ".uno:AssignLayout?WhatLayout:long=14", ".uno:AssignLayout?WhatLayout:long=16",
+ ".uno:AssignLayout?WhatLayout:long=18", ".uno:AssignLayout?WhatLayout:long=34",
+ ".uno:AssignLayout?WhatLayout:long=28", ".uno:AssignLayout?WhatLayout:long=27",
+ ".uno:AssignLayout?WhatLayout:long=29", ".uno:AssignLayout?WhatLayout:long=30")
- for i in layouts:
- self.xUITest.executeCommand(i)
+ for i in layouts:
+ self.xUITest.executeCommand(i)
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xImpressDoc.getChild("impress_win")
+ xEditWin = xImpressDoc.getChild("impress_win")
- # There's a layout with 7 objects
- for j in range(0,6):
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)}))
- xEditWin.executeAction("DESELECT", tuple())
-
- self.ui_test.close_doc()
+ # There's a layout with 7 objects
+ for j in range(0,6):
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)}))
+ xEditWin.executeAction("DESELECT", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/start.py b/uitest/impress_tests/start.py
index b6f5cbc517c9..11e82d6a9f3d 100644
--- a/uitest/impress_tests/start.py
+++ b/uitest/impress_tests/start.py
@@ -12,43 +12,39 @@ from uitest.framework import UITestCase
class SimpleImpressTest(UITestCase):
def test_start_impress(self):
- self.ui_test.create_doc_in_start_center("impress")
+ with self.ui_test.create_doc_in_start_center("impress"):
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xImpressDoc.getChild("impress_win")
- xEditWin.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
+ xEditWin = xImpressDoc.getChild("impress_win")
+ xEditWin.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
- self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200")
def test_select_page(self):
- self.ui_test.create_doc_in_start_center("impress")
-
- xTemplateDlg = self.xUITest.getTopFocusWindow()
- xCancelBtn = xTemplateDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ with self.ui_test.create_doc_in_start_center("impress"):
- xImpressDoc = self.xUITest.getTopFocusWindow()
+ xTemplateDlg = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xTemplateDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- xEditWin = xImpressDoc.getChild("impress_win")
+ xImpressDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
+ xEditWin = xImpressDoc.getChild("impress_win")
- self.xUITest.executeCommand(".uno:InsertPage")
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2")
+ self.xUITest.executeCommand(".uno:InsertPage")
- xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2")
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
+ xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
- self.ui_test.close_doc()
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
# vim: set shiftwidth=4 softtabstop=4 expandtab: