summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 11:57:03 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 13:18:38 +0200
commit3874e092da4acbaa076d885444f26f014fd781b5 (patch)
tree8342124c5325ad188f9b4be87052c4a884af560e /uitest
parent57e8d25a40d7c053fef8ecb452e159264c659604 (diff)
uitest: guard the remaining create_doc_in_start_center
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < 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>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/demo_ui/char_dialog.py9
-rw-r--r--uitest/demo_ui/checkbox.py9
-rw-r--r--uitest/demo_ui/combobox.py15
-rw-r--r--uitest/demo_ui/command_with_parameters.py11
-rw-r--r--uitest/demo_ui/edit.py40
-rw-r--r--uitest/demo_ui/gridwin.py37
-rw-r--r--uitest/demo_ui/hierarchy.py15
-rw-r--r--uitest/demo_ui/listbox.py14
-rw-r--r--uitest/demo_ui/radiobutton.py9
-rw-r--r--uitest/demo_ui/spinfield.py47
-rw-r--r--uitest/demo_ui/tabcontrol.py23
-rw-r--r--uitest/demo_ui/tabdialog.py14
-rw-r--r--uitest/demo_ui/treelist.py31
-rw-r--r--uitest/impress_tests/backgrounds.py41
-rw-r--r--uitest/impress_tests/drawinglayer.py174
-rw-r--r--uitest/impress_tests/layouts.py41
-rw-r--r--uitest/impress_tests/start.py40
-rw-r--r--uitest/math_tests/start.py73
-rw-r--r--uitest/uitest/uihelper/testDialog.py29
19 files changed, 318 insertions, 354 deletions
diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py
index 96028621a25a..1f231c3b39c3 100644
--- a/uitest/demo_ui/char_dialog.py
+++ b/uitest/demo_ui/char_dialog.py
@@ -11,15 +11,14 @@ 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:
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xCharDialog:
- xCharSet = xCharDialog.getChild("showcharset")
+ xCharSet = xCharDialog.getChild("showcharset")
- xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))
+ xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py
index 1d0c96902b44..d944b62d37d4 100644
--- a/uitest/demo_ui/checkbox.py
+++ b/uitest/demo_ui/checkbox.py
@@ -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())
+ 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:
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py
index 8b47f8338fb9..924b5c3af035 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -14,17 +14,16 @@ 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()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- scopeCB = xAddNameDlg.getChild("scope")
- select_pos(scopeCB, "1")
+ scopeCB = xAddNameDlg.getChild("scope")
+ select_pos(scopeCB, "1")
- xCancelBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xCancelBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/command_with_parameters.py b/uitest/demo_ui/command_with_parameters.py
index c82d3359559a..3a140643b659 100644
--- a/uitest/demo_ui/command_with_parameters.py
+++ b/uitest/demo_ui/command_with_parameters.py
@@ -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.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:
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 48ada3b1d15e..7007c07b4a90 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -16,40 +16,38 @@ 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()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- xEdit = xAddNameDlg.getChild("edit")
+ xEdit = xAddNameDlg.getChild("edit")
- type_text(xEdit, "simpleRangeName")
+ type_text(xEdit, "simpleRangeName")
- xAddBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xAddBtn)
+ 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()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- xEdit = xAddNameDlg.getChild("edit")
+ xEdit = xAddNameDlg.getChild("edit")
- type_text(xEdit, "simpleRangeName")
- xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
- type_text(xEdit, "otherChars")
- self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"])
+ type_text(xEdit, "simpleRangeName")
+ xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"}))
+ type_text(xEdit, "otherChars")
+ self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"])
- select_text(xEdit, from_pos="2", to="12")
- self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
+ select_text(xEdit, from_pos="2", to="12")
+ self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
- xAddBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xAddBtn)
+ xAddBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xAddBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py
index ddfb13273bb8..142c395f22c9 100644
--- a/uitest/demo_ui/gridwin.py
+++ b/uitest/demo_ui/gridwin.py
@@ -13,39 +13,36 @@ class GridWinTest(UITestCase):
def test_select_cell(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
+ 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)
+ 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")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
+ 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)
+ 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")
- xTopWindow = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xTopWindow = self.xUITest.getTopFocusWindow()
- xGridWindow = xTopWindow.getChild("grid_window")
+ xGridWindow = xTopWindow.getChild("grid_window")
- selectProps = mkPropertyValues({"RANGE": "B10:C20"})
- xGridWindow.executeAction("SELECT", selectProps)
+ selectProps = mkPropertyValues({"RANGE": "B10:C20"})
+ xGridWindow.executeAction("SELECT", selectProps)
- select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"})
- xGridWindow.executeAction("SELECT", select2Props)
+ select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"})
+ xGridWindow.executeAction("SELECT", select2Props)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py
index 1bfc85d7d99f..b17626a108ca 100644
--- a/uitest/demo_ui/hierarchy.py
+++ b/uitest/demo_ui/hierarchy.py
@@ -15,18 +15,17 @@ 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:
+ with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose") as xAboutDlg:
- json_string = xAboutDlg.getHierarchy()
- print(json_string)
- json_content = json.loads(json_string)
- print(json_content)
- print(json.dumps(json_content, indent=4))
+ json_string = xAboutDlg.getHierarchy()
+ print(json_string)
+ json_content = json.loads(json_string)
+ print(json_content)
+ print(json.dumps(json_content, indent=4))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py
index 3a61d5f9717e..6a1a075d35f4 100644
--- a/uitest/demo_ui/listbox.py
+++ b/uitest/demo_ui/listbox.py
@@ -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
+ 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
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
+ pass
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py
index f76192b4ffb0..628cf2a38834 100644
--- a/uitest/demo_ui/radiobutton.py
+++ b/uitest/demo_ui/radiobutton.py
@@ -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())
+ 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:
diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py
index d29ce33141ab..bed26702122b 100644
--- a/uitest/demo_ui/spinfield.py
+++ b/uitest/demo_ui/spinfield.py
@@ -14,53 +14,50 @@ 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:
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
- xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
- xDecimalPlaces.executeAction("UP", tuple())
+ xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
+ xDecimalPlaces.executeAction("UP", tuple())
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "2")
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ 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:
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
- xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
- xDecimalPlaces.executeAction("UP", tuple())
- xDecimalPlaces.executeAction("UP", tuple())
+ xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
+ xDecimalPlaces.executeAction("UP", tuple())
+ xDecimalPlaces.executeAction("UP", tuple())
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "3")
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ assert(decimal_places_state["Text"] == "3")
- xDecimalPlaces.executeAction("DOWN", tuple())
+ xDecimalPlaces.executeAction("DOWN", tuple())
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "2")
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ 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:
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
- xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
- type_text(xDecimalPlaces, "4")
+ xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
+ type_text(xDecimalPlaces, "4")
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "41")
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ assert(decimal_places_state["Text"] == "41")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py
index 47b3f33a3cf4..f47c51f8303c 100644
--- a/uitest/demo_ui/tabcontrol.py
+++ b/uitest/demo_ui/tabcontrol.py
@@ -16,23 +16,22 @@ 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")
- enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
- xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+ enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
- self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
- xFunctionDlg = self.xUITest.getTopFocusWindow()
+ xFunctionDlg = self.xUITest.getTopFocusWindow()
- xTabs = xFunctionDlg.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ xTabs = xFunctionDlg.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xCancelBtn = xFunctionDlg.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
+ xCancelBtn = xFunctionDlg.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py
index 95eb3b1e81be..e3fde961f014 100644
--- a/uitest/demo_ui/tabdialog.py
+++ b/uitest/demo_ui/tabdialog.py
@@ -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
+ 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
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
+ pass
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py
index 265fa8b975b3..20331230df08 100644
--- a/uitest/demo_ui/treelist.py
+++ b/uitest/demo_ui/treelist.py
@@ -16,31 +16,30 @@ 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")
- enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
- xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+ enter_text_to_cell(xGridWindow, "B2", "=2+3+4")
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
- self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
- xFunctionDlg = self.xUITest.getTopFocusWindow()
+ xFunctionDlg = self.xUITest.getTopFocusWindow()
- xTabs = xFunctionDlg.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ xTabs = xFunctionDlg.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xTreelist = xTabs.getChild("struct")
+ xTreelist = xTabs.getChild("struct")
- xTreeEntry = xTreelist.getChild('0')
+ xTreeEntry = xTreelist.getChild('0')
- xTreeEntry.executeAction("COLLAPSE", tuple())
+ xTreeEntry.executeAction("COLLAPSE", tuple())
- xTreeEntry.executeAction("EXPAND", tuple())
+ xTreeEntry.executeAction("EXPAND", tuple())
- xCancelBtn = xFunctionDlg.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
+ xCancelBtn = xFunctionDlg.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py
index f37ef2a22a44..256878926967 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -105,38 +105,37 @@ 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")
- 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):
- with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg:
+ buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
+ for index, button in enumerate(buttons):
+ with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg:
- 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
+ # tdf#100024: Without the fix in place, this test would have crashed here
+ # changing the background to bitmap
- self.checkDefaultBackground(button)
+ self.checkDefaultBackground(button)
- with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg:
+ with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg:
- 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())
- self.checkDefaultBackground('btnnone')
+ self.checkDefaultBackground('btnnone')
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index bc1e785f65e3..93edd5503df7 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -13,134 +13,128 @@ 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")
- 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)
+ 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())
- with self.ui_test.execute_dialog_through_command(".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'])
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertIsNone(document.CurrentSelection)
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ 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")
- 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(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(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)
- xEditWin = xImpressDoc.getChild("impress_win")
+ xEditWin = xImpressDoc.getChild("impress_win")
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
- 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)
+ 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)
- 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())
- with self.ui_test.execute_dialog_through_command(".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'])
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertIsNone(document.CurrentSelection)
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ 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")
- 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()
- 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)
+ 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)
- xEditWin = xImpressDoc.getChild("impress_win")
+ xEditWin = xImpressDoc.getChild("impress_win")
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"}))
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"}))
- 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)
+ 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)
- 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())
- with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog:
- self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+ with self.ui_test.execute_dialog_through_command(".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())
- self.assertIsNone(document.CurrentSelection)
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/layouts.py b/uitest/impress_tests/layouts.py
index ebbe8e2ec266..1c7c3b43bf8c 100644
--- a/uitest/impress_tests/layouts.py
+++ b/uitest/impress_tests/layouts.py
@@ -11,33 +11,32 @@ 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")
- 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())
+ # 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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/impress_tests/start.py b/uitest/impress_tests/start.py
index b6f5cbc517c9..f9e51cf249d8 100644
--- a/uitest/impress_tests/start.py
+++ b/uitest/impress_tests/start.py
@@ -12,43 +12,41 @@ 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")
- 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.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")
- 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 = xImpressDoc.getChild("impress_win")
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
- self.xUITest.executeCommand(".uno:InsertPage")
+ self.xUITest.executeCommand(".uno:InsertPage")
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2")
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2")
- xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
+ xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
- self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
+ self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py
index 2ad977f73917..700e38c7c87d 100644
--- a/uitest/math_tests/start.py
+++ b/uitest/math_tests/start.py
@@ -18,74 +18,69 @@ 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()
+ 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()
+ xMathDoc = self.xUITest.getTopFocusWindow()
- xList = xMathDoc.getChild("listbox")
- state = get_state_as_dict(xList)
- self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
- select_pos(xList, "1")
- state = get_state_as_dict(xList)
- self.assertEqual(state["SelectEntryText"], "Relations")
+ xList = xMathDoc.getChild("listbox")
+ state = get_state_as_dict(xList)
+ self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
+ select_pos(xList, "1")
+ 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()
+ xMathDoc = self.xUITest.getTopFocusWindow()
- xMathEdit = xMathDoc.getChild("math_edit")
+ xMathEdit = xMathDoc.getChild("math_edit")
- type_text(xMathEdit, "E=mc^2")
+ 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()
+ xMathDoc = self.xUITest.getTopFocusWindow()
- xMathSelector = xMathDoc.getChild("element_selector")
+ xMathSelector = xMathDoc.getChild("element_selector")
- xElement = xMathSelector.getChild("1")
- xElement.executeAction("SELECT", tuple())
+ 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()
+ xMathDoc = self.xUITest.getTopFocusWindow()
- xList = xMathDoc.getChild("listbox")
- state = get_state_as_dict(xList)
- self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
- select_pos(xList, "1")
+ xList = xMathDoc.getChild("listbox")
+ state = get_state_as_dict(xList)
+ self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
+ select_pos(xList, "1")
- xMathSelector = xMathDoc.getChild("element_selector")
+ xMathSelector = xMathDoc.getChild("element_selector")
- xElement = xMathSelector.getChild("1")
- xElement.executeAction("SELECT", tuple())
+ xElement = xMathSelector.getChild("1")
+ xElement.executeAction("SELECT", tuple())
- xMathEdit = xMathDoc.getChild("math_edit")
- type_text(xMathEdit, "1")
- xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
- type_text(xMathEdit, "2")
+ xMathEdit = xMathDoc.getChild("math_edit")
+ type_text(xMathEdit, "1")
+ xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
+ type_text(xMathEdit, "2")
- edit_state = get_state_as_dict(xMathEdit)
- self.assertEqual("1 <> 2 ", edit_state["Text"])
+ 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:
diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py
index d1bb47856acf..828f1ca6b07f 100644
--- a/uitest/uitest/uihelper/testDialog.py
+++ b/uitest/uitest/uihelper/testDialog.py
@@ -12,22 +12,21 @@ 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.execute_dialog_through_command(dialog['command'], close_button=dialog['closeButton']) as xDialog:
- if 'skipTestOK' in dialog and dialog['skipTestOK'] == True:
- xOKBtn = None
- else:
- try:
- xOKBtn = xDialog.getChild("ok")
- if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
- xOKBtn = None
- except:
+ 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
+ else:
+ try:
+ xOKBtn = xDialog.getChild("ok")
+ if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
+ xOKBtn = None
+ except:
+ xOKBtn = None
- if (xOKBtn != None):
- print("check also OK button")
- with UITestCase.ui_test.execute_dialog_through_command(dialog['command']):
- pass
- UITestCase.ui_test.close_doc()
+ if (xOKBtn != None):
+ print("check also OK button")
+ with UITestCase.ui_test.execute_dialog_through_command(dialog['command']):
+ pass
# vim: set shiftwidth=4 softtabstop=4 expandtab: