uitest: guard the remaining create_doc_in_start_center
Mostly done by a script
for motivation, see 89aaa17a0a
< UITest: introduce guarded context managers >
Change-Id: I2a6149b318d1fdaa36efe5d65af4c238827eaaf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118154
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
@@ -14,7 +14,7 @@ class Test(UITestCase):
|
||||
|
||||
def testSvxCharEffectsPage(self):
|
||||
# Start Impress.
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress") as component:
|
||||
template = self.xUITest.getTopFocusWindow()
|
||||
self.ui_test.close_dialog_through_button(template.getChild("close"))
|
||||
doc = self.xUITest.getTopFocusWindow()
|
||||
@@ -34,7 +34,6 @@ class Test(UITestCase):
|
||||
xFontTransparency.executeAction("UP", tuple())
|
||||
|
||||
# Verify the result.
|
||||
component = self.ui_test.get_component()
|
||||
drawPage = component.getDrawPages().getByIndex(0)
|
||||
shape = drawPage.getByIndex(0)
|
||||
|
||||
@@ -43,11 +42,10 @@ class Test(UITestCase):
|
||||
# i.e. the dialog did not set transparency to 5%, instead it left the character color at
|
||||
# COL_AUTO.
|
||||
self.assertEqual(shape.CharTransparence, 5)
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def testSvxCharEffectsPageWriter(self):
|
||||
# Start Writer.
|
||||
self.ui_test.create_doc_in_start_center("writer")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("writer") as component:
|
||||
doc = self.xUITest.getTopFocusWindow()
|
||||
editWin = doc.getChild("writer_edit")
|
||||
# Type a character and select it.
|
||||
@@ -69,15 +67,13 @@ class Test(UITestCase):
|
||||
xFontTransparency.executeAction("UP", tuple())
|
||||
|
||||
# Verify the result.
|
||||
component = self.ui_test.get_component()
|
||||
paragraph = component.Text.createEnumeration().nextElement()
|
||||
|
||||
self.assertEqual(paragraph.CharTransparence, 5)
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def testSvxCharEffectsPageWriterAutomatic(self):
|
||||
# Start Writer.
|
||||
self.ui_test.create_doc_in_start_center("writer")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("writer"):
|
||||
doc = self.xUITest.getTopFocusWindow()
|
||||
editWin = doc.getChild("writer_edit")
|
||||
|
||||
@@ -92,6 +88,5 @@ class Test(UITestCase):
|
||||
# i.e. the auto color lost its alpha component and appeared as white.
|
||||
self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,7 +14,7 @@ class Test(UITestCase):
|
||||
|
||||
def testGetFormat(self):
|
||||
# Copy a string in Impress.
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress"):
|
||||
template = self.xUITest.getTopFocusWindow()
|
||||
self.ui_test.close_dialog_through_button(template.getChild("close"))
|
||||
doc = self.xUITest.getTopFocusWindow()
|
||||
@@ -39,6 +39,5 @@ class Test(UITestCase):
|
||||
self.assertTrue("Rich text formatting (RTF)" in items)
|
||||
self.assertFalse("Rich text formatting (Richtext)" in items)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -13,7 +13,7 @@ from uitest.uihelper.common import get_state_as_dict
|
||||
class Test(UITestCase):
|
||||
|
||||
def test_tab_navigation(self):
|
||||
self.ui_test.create_doc_in_start_center("writer")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("writer"):
|
||||
xWriterDoc = self.xUITest.getTopFocusWindow()
|
||||
xWriterEdit = xWriterDoc.getChild("writer_edit")
|
||||
|
||||
@@ -35,6 +35,5 @@ class Test(UITestCase):
|
||||
self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i))
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,7 +14,7 @@ class SvxTableControllerTest(UITestCase):
|
||||
|
||||
def testOnFormatTable(self):
|
||||
# Create an Impress document with a single table in it.
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress") as component:
|
||||
template = self.xUITest.getTopFocusWindow()
|
||||
self.ui_test.close_dialog_through_button(template.getChild("close"))
|
||||
self.xUITest.executeCommand(".uno:SelectAll")
|
||||
@@ -30,7 +30,6 @@ class SvxTableControllerTest(UITestCase):
|
||||
shadowCheckbox.executeAction("CLICK", tuple())
|
||||
|
||||
# Check if the shadow was enabled.
|
||||
component = self.ui_test.get_component()
|
||||
drawPage = component.getDrawPages().getByIndex(0)
|
||||
shape = drawPage.getByIndex(0)
|
||||
# Without the accompanying fix in place, this test would have failed with:
|
||||
@@ -39,11 +38,10 @@ class SvxTableControllerTest(UITestCase):
|
||||
self.assertEqual(shape.Shadow, True)
|
||||
|
||||
# Close the document.
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def testUndoCrash(self):
|
||||
# Given an Impress document with a single table in it:
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress"):
|
||||
template = self.xUITest.getTopFocusWindow()
|
||||
self.ui_test.close_dialog_through_button(template.getChild("close"))
|
||||
self.xUITest.executeCommand(".uno:SelectAll")
|
||||
@@ -74,6 +72,5 @@ class SvxTableControllerTest(UITestCase):
|
||||
self.xUITest.executeCommand(".uno:Undo")
|
||||
|
||||
# Close the document.
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -11,7 +11,7 @@ from uitest.framework import UITestCase
|
||||
class CharDialogText(UITestCase):
|
||||
|
||||
def test_select_char(self):
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xCharDialog:
|
||||
|
||||
@@ -20,6 +20,5 @@ class CharDialogText(UITestCase):
|
||||
xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -13,13 +13,12 @@ class CheckBoxTest(UITestCase):
|
||||
|
||||
def test_toggle_checkbox(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
|
||||
xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
|
||||
xNegativeNumRedCB.executeAction("CLICK",tuple())
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,7 +14,7 @@ class ComboBoxTest(UITestCase):
|
||||
|
||||
def test_select_entry_pos(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
|
||||
xAddNameDlg = self.xUITest.getTopFocusWindow()
|
||||
@@ -25,6 +25,5 @@ class ComboBoxTest(UITestCase):
|
||||
xCancelBtn = xAddNameDlg.getChild("cancel")
|
||||
self.ui_test.close_dialog_through_button(xCancelBtn)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -12,13 +12,12 @@ class CommandWithParametersTest(UITestCase):
|
||||
|
||||
def test_text_color_change(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("writer")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("writer"):
|
||||
|
||||
self.xUITest.executeCommandWithParameters(".uno:Color",
|
||||
mkPropertyValues({"Color": 16776960}))
|
||||
xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
|
||||
type_text(xWriterEdit, "LibreOffice")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -16,7 +16,7 @@ class EditTest(UITestCase):
|
||||
|
||||
def test_type_text(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
|
||||
xAddNameDlg = self.xUITest.getTopFocusWindow()
|
||||
@@ -28,11 +28,10 @@ class EditTest(UITestCase):
|
||||
xAddBtn = xAddNameDlg.getChild("cancel")
|
||||
self.ui_test.close_dialog_through_button(xAddBtn)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_select_text(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
|
||||
xAddNameDlg = self.xUITest.getTopFocusWindow()
|
||||
@@ -50,6 +49,5 @@ class EditTest(UITestCase):
|
||||
xAddBtn = xAddNameDlg.getChild("cancel")
|
||||
self.ui_test.close_dialog_through_button(xAddBtn)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -13,29 +13,27 @@ class GridWinTest(UITestCase):
|
||||
|
||||
def test_select_cell(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
xCalcDoc = self.xUITest.getTopFocusWindow()
|
||||
xGridWindow = xCalcDoc.getChild("grid_window")
|
||||
|
||||
selectProps = mkPropertyValues({"CELL": "B10"})
|
||||
xGridWindow.executeAction("SELECT", selectProps)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_select_range(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
xCalcDoc = self.xUITest.getTopFocusWindow()
|
||||
xGridWindow = xCalcDoc.getChild("grid_window")
|
||||
|
||||
selectProps = mkPropertyValues({"RANGE": "B10:C20"})
|
||||
xGridWindow.executeAction("SELECT", selectProps)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_extend_range(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
xTopWindow = self.xUITest.getTopFocusWindow()
|
||||
|
||||
xGridWindow = xTopWindow.getChild("grid_window")
|
||||
@@ -46,6 +44,5 @@ class GridWinTest(UITestCase):
|
||||
select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"})
|
||||
xGridWindow.executeAction("SELECT", select2Props)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -15,7 +15,7 @@ class CheckBoxTest(UITestCase):
|
||||
|
||||
def test_get_json(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose") as xAboutDlg:
|
||||
|
||||
@@ -27,6 +27,5 @@ class CheckBoxTest(UITestCase):
|
||||
print(json.dumps(json_content, indent=4))
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,20 +14,18 @@ class ListBoxTest(UITestCase):
|
||||
|
||||
def test_select_entry_pos(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
|
||||
pass
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_select_entry_text(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
|
||||
pass
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -25,13 +25,12 @@ class RadioButtonTest(UITestCase):
|
||||
|
||||
def test_toggle_radiobutton(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
|
||||
xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
|
||||
xNegativeNumRedCB.executeAction("CLICK",tuple())
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,7 +14,7 @@ class SpinFieldTest(UITestCase):
|
||||
|
||||
def test_up(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
|
||||
|
||||
@@ -25,11 +25,10 @@ class SpinFieldTest(UITestCase):
|
||||
assert(decimal_places_state["Text"] == "2")
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_down(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
|
||||
|
||||
@@ -46,11 +45,10 @@ class SpinFieldTest(UITestCase):
|
||||
assert(decimal_places_state["Text"] == "2")
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_text(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
|
||||
|
||||
@@ -61,6 +59,5 @@ class SpinFieldTest(UITestCase):
|
||||
assert(decimal_places_state["Text"] == "41")
|
||||
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -16,7 +16,7 @@ class TabControlTest(UITestCase):
|
||||
|
||||
def test_select_pos(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
xCalcDoc = self.xUITest.getTopFocusWindow()
|
||||
xGridWindow = xCalcDoc.getChild("grid_window")
|
||||
@@ -33,6 +33,5 @@ class TabControlTest(UITestCase):
|
||||
xCancelBtn = xFunctionDlg.getChild("cancel")
|
||||
xCancelBtn.executeAction("CLICK", tuple())
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -14,20 +14,18 @@ class TabDialogTest(UITestCase):
|
||||
|
||||
def test_select_tab_page_pos(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
|
||||
pass
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_select_tab_page_name(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
|
||||
pass
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -16,7 +16,7 @@ class TreeListTest(UITestCase):
|
||||
|
||||
def test_expand(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("calc")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("calc"):
|
||||
|
||||
xCalcDoc = self.xUITest.getTopFocusWindow()
|
||||
xGridWindow = xCalcDoc.getChild("grid_window")
|
||||
@@ -41,6 +41,5 @@ class TreeListTest(UITestCase):
|
||||
xCancelBtn = xFunctionDlg.getChild("cancel")
|
||||
xCancelBtn.executeAction("CLICK", tuple())
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -105,7 +105,7 @@ 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_guarded("impress"):
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -137,6 +137,5 @@ class ImpressBackgrounds(UITestCase):
|
||||
|
||||
self.checkDefaultBackground('btnnone')
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -13,7 +13,7 @@ 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_guarded("impress") as document:
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -23,7 +23,6 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
|
||||
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)
|
||||
@@ -55,10 +54,9 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
xEditWin.executeAction("DESELECT", tuple())
|
||||
self.assertIsNone(document.CurrentSelection)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_resize_object(self):
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress") as document:
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -68,7 +66,6 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
|
||||
xImpressDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
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)
|
||||
@@ -100,10 +97,9 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
xEditWin.executeAction("DESELECT", tuple())
|
||||
self.assertIsNone(document.CurrentSelection)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_rotate_object(self):
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress") as document:
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -111,7 +107,6 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
|
||||
xImpressDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
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)
|
||||
@@ -141,6 +136,5 @@ class ImpressDrawinglayerTest(UITestCase):
|
||||
xEditWin.executeAction("DESELECT", tuple())
|
||||
self.assertIsNone(document.CurrentSelection)
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -11,7 +11,7 @@ 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_guarded("impress"):
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -38,6 +38,5 @@ class ImpressLayouts(UITestCase):
|
||||
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)}))
|
||||
xEditWin.executeAction("DESELECT", tuple())
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -12,7 +12,7 @@ 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_guarded("impress"):
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -25,11 +25,10 @@ class SimpleImpressTest(UITestCase):
|
||||
|
||||
self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_select_page(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("impress")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("impress"):
|
||||
|
||||
xTemplateDlg = self.xUITest.getTopFocusWindow()
|
||||
xCancelBtn = xTemplateDlg.getChild("close")
|
||||
@@ -49,6 +48,5 @@ class SimpleImpressTest(UITestCase):
|
||||
|
||||
self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -18,15 +18,14 @@ class SimpleMathTest(UITestCase):
|
||||
|
||||
def test_start_math(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("math")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("math"):
|
||||
|
||||
xMathDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_docking_window_listbox(self):
|
||||
|
||||
self.ui_test.create_doc_in_start_center("math")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("math"):
|
||||
|
||||
xMathDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
@@ -37,10 +36,9 @@ class SimpleMathTest(UITestCase):
|
||||
state = get_state_as_dict(xList)
|
||||
self.assertEqual(state["SelectEntryText"], "Relations")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_math_edit(self):
|
||||
self.ui_test.create_doc_in_start_center("math")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("math"):
|
||||
|
||||
xMathDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
@@ -48,10 +46,9 @@ class SimpleMathTest(UITestCase):
|
||||
|
||||
type_text(xMathEdit, "E=mc^2")
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
def test_math_selector(self):
|
||||
self.ui_test.create_doc_in_start_center("math")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("math"):
|
||||
|
||||
xMathDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
@@ -60,11 +57,10 @@ class SimpleMathTest(UITestCase):
|
||||
xElement = xMathSelector.getChild("1")
|
||||
xElement.executeAction("SELECT", tuple())
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
@unittest.skip("on windows the f4 does not always work")
|
||||
def test_complete_math(self):
|
||||
self.ui_test.create_doc_in_start_center("math")
|
||||
with self.ui_test.create_doc_in_start_center_guarded("math"):
|
||||
|
||||
xMathDoc = self.xUITest.getTopFocusWindow()
|
||||
|
||||
@@ -86,6 +82,5 @@ class SimpleMathTest(UITestCase):
|
||||
edit_state = get_state_as_dict(xMathEdit)
|
||||
self.assertEqual("1 <> 2 ", edit_state["Text"])
|
||||
|
||||
self.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -12,7 +12,7 @@ from uitest.uihelper.common import get_state_as_dict
|
||||
# and if there is an "OK" button open the dialog again and close it by using the OK button
|
||||
# the test only checks if LibreOffice crashes by opening the dialog
|
||||
def testDialog(UITestCase, app, dialog):
|
||||
doc = UITestCase.ui_test.create_doc_in_start_center(app)
|
||||
with UITestCase.ui_test.create_doc_in_start_center_guarded(app):
|
||||
with UITestCase.ui_test.execute_dialog_through_command(dialog['command'], close_button=dialog['closeButton']) as xDialog:
|
||||
if 'skipTestOK' in dialog and dialog['skipTestOK'] == True:
|
||||
xOKBtn = None
|
||||
@@ -28,6 +28,5 @@ def testDialog(UITestCase, app, dialog):
|
||||
print("check also OK button")
|
||||
with UITestCase.ui_test.execute_dialog_through_command(dialog['command']):
|
||||
pass
|
||||
UITestCase.ui_test.close_doc()
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
Reference in New Issue
Block a user