summaryrefslogtreecommitdiff
path: root/uitest
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
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')
-rw-r--r--uitest/demo_ui/char_dialog.py16
-rw-r--r--uitest/demo_ui/checkbox.py16
-rw-r--r--uitest/demo_ui/combobox.py16
-rw-r--r--uitest/demo_ui/command_with_parameters.py12
-rw-r--r--uitest/demo_ui/edit.py42
-rw-r--r--uitest/demo_ui/gridwin.py40
-rw-r--r--uitest/demo_ui/hierarchy.py22
-rw-r--r--uitest/demo_ui/listbox.py24
-rw-r--r--uitest/demo_ui/radiobutton.py16
-rw-r--r--uitest/demo_ui/spinfield.py68
-rw-r--r--uitest/demo_ui/tabcontrol.py24
-rw-r--r--uitest/demo_ui/tabdialog.py24
-rw-r--r--uitest/demo_ui/treelist.py32
-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
-rw-r--r--uitest/math_tests/start.py78
-rw-r--r--uitest/uitest/test.py6
-rw-r--r--uitest/uitest/uihelper/guarded.py10
-rw-r--r--uitest/uitest/uihelper/testDialog.py39
21 files changed, 376 insertions, 445 deletions
diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py
index 5dd0212ee719..c261dda1e3a9 100644
--- a/uitest/demo_ui/char_dialog.py
+++ b/uitest/demo_ui/char_dialog.py
@@ -11,18 +11,16 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
- xCharDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
+ xCharDialog = self.xUITest.getTopFocusWindow()
- xCharSet = xCharDialog.getChild("showcharset")
+ xCharSet = xCharDialog.getChild("showcharset")
- xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))
+ xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))
- xCancelBtn = xCharDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ xCancelBtn = xCharDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py
index 114473d53851..fd2a649b4a28 100644
--- a/uitest/demo_ui/checkbox.py
+++ b/uitest/demo_ui/checkbox.py
@@ -13,16 +13,14 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
- xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
- xNegativeNumRedCB.executeAction("CLICK",tuple())
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
+ xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
+ xNegativeNumRedCB.executeAction("CLICK",tuple())
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
-
- self.ui_test.close_doc()
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py
index 8b47f8338fb9..f8c7ad9413cf 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -14,17 +14,15 @@ 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("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)
-
- self.ui_test.close_doc()
+ xCancelBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# 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..689415207e3b 100644
--- a/uitest/demo_ui/command_with_parameters.py
+++ b/uitest/demo_ui/command_with_parameters.py
@@ -12,13 +12,11 @@ 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("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()
+ self.xUITest.executeCommandWithParameters(".uno:Color",
+ mkPropertyValues({"Color": 16776960}))
+ xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
+ type_text(xWriterEdit, "LibreOffice")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 48ada3b1d15e..0dcc82093fa0 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -16,40 +16,36 @@ 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("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)
-
- self.ui_test.close_doc()
+ xAddBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xAddBtn)
def test_select_text(self):
- self.ui_test.create_doc_in_start_center("calc")
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- xAddNameDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("calc"):
- xEdit = xAddNameDlg.getChild("edit")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- 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"])
+ xEdit = xAddNameDlg.getChild("edit")
- select_text(xEdit, from_pos="2", to="12")
- self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
+ 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"])
- xAddBtn = xAddNameDlg.getChild("cancel")
- self.ui_test.close_dialog_through_button(xAddBtn)
+ select_text(xEdit, from_pos="2", to="12")
+ self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"])
- self.ui_test.close_doc()
+ xAddBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xAddBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py
index ddfb13273bb8..98d4c9c91fd0 100644
--- a/uitest/demo_ui/gridwin.py
+++ b/uitest/demo_ui/gridwin.py
@@ -13,39 +13,33 @@ 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("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
- selectProps = mkPropertyValues({"CELL": "B10"})
- xGridWindow.executeAction("SELECT", selectProps)
-
- self.ui_test.close_doc()
+ selectProps = mkPropertyValues({"CELL": "B10"})
+ xGridWindow.executeAction("SELECT", selectProps)
def test_select_range(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
-
- selectProps = mkPropertyValues({"RANGE": "B10:C20"})
- xGridWindow.executeAction("SELECT", selectProps)
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
- self.ui_test.close_doc()
+ selectProps = mkPropertyValues({"RANGE": "B10:C20"})
+ xGridWindow.executeAction("SELECT", selectProps)
def test_extend_range(self):
- self.ui_test.create_doc_in_start_center("calc")
- xTopWindow = self.xUITest.getTopFocusWindow()
-
- xGridWindow = xTopWindow.getChild("grid_window")
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xTopWindow = self.xUITest.getTopFocusWindow()
- selectProps = mkPropertyValues({"RANGE": "B10:C20"})
- xGridWindow.executeAction("SELECT", selectProps)
+ xGridWindow = xTopWindow.getChild("grid_window")
- select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"})
- xGridWindow.executeAction("SELECT", select2Props)
+ selectProps = mkPropertyValues({"RANGE": "B10:C20"})
+ xGridWindow.executeAction("SELECT", selectProps)
- self.ui_test.close_doc()
+ select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"})
+ xGridWindow.executeAction("SELECT", select2Props)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py
index f5434366fda4..31f123cef230 100644
--- a/uitest/demo_ui/hierarchy.py
+++ b/uitest/demo_ui/hierarchy.py
@@ -15,21 +15,19 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:About")
+ self.ui_test.execute_dialog_through_command(".uno:About")
- xAboutDlg = self.xUITest.getTopFocusWindow()
+ xAboutDlg = self.xUITest.getTopFocusWindow()
- 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))
- closeBtn = xAboutDlg.getChild("btnClose")
- self.ui_test.close_dialog_through_button(closeBtn)
-
- self.ui_test.close_doc()
+ closeBtn = xAboutDlg.getChild("btnClose")
+ self.ui_test.close_dialog_through_button(closeBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py
index 7e9ae16e6543..4bce5c2ba258 100644
--- a/uitest/demo_ui/listbox.py
+++ b/uitest/demo_ui/listbox.py
@@ -14,26 +14,22 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.close_doc()
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
def test_select_entry_text(self):
- self.ui_test.create_doc_in_start_center("calc")
-
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("calc"):
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- self.ui_test.close_doc()
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py
index bb2f5bd07440..f8d49587b0e0 100644
--- a/uitest/demo_ui/radiobutton.py
+++ b/uitest/demo_ui/radiobutton.py
@@ -25,16 +25,14 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
- xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
- xNegativeNumRedCB.executeAction("CLICK",tuple())
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
+ xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
+ xNegativeNumRedCB.executeAction("CLICK",tuple())
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
-
- self.ui_test.close_doc()
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py
index a74e47206274..9469bc9254d1 100644
--- a/uitest/demo_ui/spinfield.py
+++ b/uitest/demo_ui/spinfield.py
@@ -14,62 +14,56 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- 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")
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
-
- self.ui_test.close_doc()
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
def test_down(self):
- self.ui_test.create_doc_in_start_center("calc")
+ with self.ui_test.create_doc_in_start_center("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- 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())
-
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "2")
+ xDecimalPlaces.executeAction("DOWN", tuple())
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ assert(decimal_places_state["Text"] == "2")
- self.ui_test.close_doc()
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
def test_text(self):
- self.ui_test.create_doc_in_start_center("calc")
+ with self.ui_test.create_doc_in_start_center("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
- type_text(xDecimalPlaces, "4")
-
- decimal_places_state = get_state_as_dict(xDecimalPlaces)
- assert(decimal_places_state["Text"] == "41")
+ xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
+ type_text(xDecimalPlaces, "4")
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ decimal_places_state = get_state_as_dict(xDecimalPlaces)
+ assert(decimal_places_state["Text"] == "41")
- self.ui_test.close_doc()
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py
index 47b3f33a3cf4..4da9e8ee9782 100644
--- a/uitest/demo_ui/tabcontrol.py
+++ b/uitest/demo_ui/tabcontrol.py
@@ -16,23 +16,21 @@ 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("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())
-
- self.ui_test.close_doc()
+ xCancelBtn = xFunctionDlg.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py
index 861b270989d9..00e9c0e161b8 100644
--- a/uitest/demo_ui/tabdialog.py
+++ b/uitest/demo_ui/tabdialog.py
@@ -14,26 +14,22 @@ 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("calc"):
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- self.ui_test.close_doc()
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
def test_select_tab_page_name(self):
- self.ui_test.create_doc_in_start_center("calc")
-
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xCellsDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("calc"):
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xCellsDlg = self.xUITest.getTopFocusWindow()
- self.ui_test.close_doc()
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py
index 265fa8b975b3..ad8246c5184a 100644
--- a/uitest/demo_ui/treelist.py
+++ b/uitest/demo_ui/treelist.py
@@ -16,31 +16,29 @@ 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("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())
-
- self.ui_test.close_doc()
+ xCancelBtn = xFunctionDlg.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
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:
diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py
index 2ad977f73917..9d1e51df69f7 100644
--- a/uitest/math_tests/start.py
+++ b/uitest/math_tests/start.py
@@ -18,74 +18,64 @@ 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("math"):
- xMathDoc = self.xUITest.getTopFocusWindow()
-
- self.ui_test.close_doc()
+ xMathDoc = self.xUITest.getTopFocusWindow()
def test_docking_window_listbox(self):
- self.ui_test.create_doc_in_start_center("math")
-
- xMathDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("math"):
- 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")
+ xMathDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.close_doc()
+ 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")
def test_math_edit(self):
- self.ui_test.create_doc_in_start_center("math")
-
- xMathDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("math"):
- xMathEdit = xMathDoc.getChild("math_edit")
+ xMathDoc = self.xUITest.getTopFocusWindow()
- type_text(xMathEdit, "E=mc^2")
+ xMathEdit = xMathDoc.getChild("math_edit")
- self.ui_test.close_doc()
+ type_text(xMathEdit, "E=mc^2")
def test_math_selector(self):
- self.ui_test.create_doc_in_start_center("math")
+ with self.ui_test.create_doc_in_start_center("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())
-
- self.ui_test.close_doc()
+ xElement = xMathSelector.getChild("1")
+ xElement.executeAction("SELECT", tuple())
@unittest.skip("on windows the f4 does not always work")
def test_complete_math(self):
- self.ui_test.create_doc_in_start_center("math")
-
- xMathDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("math"):
- xList = xMathDoc.getChild("listbox")
- state = get_state_as_dict(xList)
- self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
- select_pos(xList, "1")
+ xMathDoc = self.xUITest.getTopFocusWindow()
- xMathSelector = xMathDoc.getChild("element_selector")
+ xList = xMathDoc.getChild("listbox")
+ state = get_state_as_dict(xList)
+ self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
+ select_pos(xList, "1")
- xElement = xMathSelector.getChild("1")
- xElement.executeAction("SELECT", tuple())
+ xMathSelector = xMathDoc.getChild("element_selector")
- xMathEdit = xMathDoc.getChild("math_edit")
- type_text(xMathEdit, "1")
- xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
- type_text(xMathEdit, "2")
+ xElement = xMathSelector.getChild("1")
+ xElement.executeAction("SELECT", tuple())
- edit_state = get_state_as_dict(xMathEdit)
- self.assertEqual("1 <> 2 ", edit_state["Text"])
+ xMathEdit = xMathDoc.getChild("math_edit")
+ type_text(xMathEdit, "1")
+ xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
+ type_text(xMathEdit, "2")
- self.ui_test.close_doc()
+ edit_state = get_state_as_dict(xMathEdit)
+ self.assertEqual("1 <> 2 ", edit_state["Text"])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 86da1ac79cb2..723878a34e3c 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -147,6 +147,8 @@ class UITest(object):
self.close_dialog_through_button(xCancelBtn)
return True
+ # Calls UITest.close_doc at exit
+ @contextmanager
def create_doc_in_start_center(self, app):
xStartCenter = self._xUITest.getTopFocusWindow()
try:
@@ -165,6 +167,10 @@ class UITest(object):
if event.executed:
frames = self.get_frames()
self.get_desktop().setActiveFrame(frames[0])
+ try:
+ yield
+ finally:
+ self.close_doc()
return
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py
index 5cfed2d49e1a..1cc6d3cca7e6 100644
--- a/uitest/uitest/uihelper/guarded.py
+++ b/uitest/uitest/uihelper/guarded.py
@@ -9,16 +9,6 @@
from contextlib import contextmanager
-# Calls UITest.close_doc at exit
-@contextmanager
-def create_doc_in_start_center(testCase, app):
- testCase.ui_test.create_doc_in_start_center(app)
- component = testCase.ui_test.get_component()
- try:
- yield component
- finally:
- testCase.ui_test.close_doc()
-
# Calls UITest.close_dialog_through_button at exit
@contextmanager
def execute_dialog_through_action(testCase, ui_object, action, parameters = None, event_name = "DialogExecute", close_button = "ok"):
diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py
index 43f0a5bc0794..d1cf007fa0cb 100644
--- a/uitest/uitest/uihelper/testDialog.py
+++ b/uitest/uitest/uihelper/testDialog.py
@@ -12,28 +12,27 @@ 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)
- UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
- xDialog = UITestCase.xUITest.getTopFocusWindow()
+ with UITestCase.ui_test.create_doc_in_start_center(app):
+ UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
+ xDialog = UITestCase.xUITest.getTopFocusWindow()
- xCloseBtn = xDialog.getChild(dialog['closeButton'])
- 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:
+ xCloseBtn = xDialog.getChild(dialog['closeButton'])
+ 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
- UITestCase.ui_test.close_dialog_through_button(xCloseBtn)
- if (xOKBtn != None):
- print("check also OK button")
- UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
- xDialog = UITestCase.xUITest.getTopFocusWindow()
- xOKBtn = xDialog.getChild("ok")
- UITestCase.ui_test.close_dialog_through_button(xOKBtn)
- UITestCase.ui_test.close_doc()
+ UITestCase.ui_test.close_dialog_through_button(xCloseBtn)
+ if (xOKBtn != None):
+ print("check also OK button")
+ UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
+ xDialog = UITestCase.xUITest.getTopFocusWindow()
+ xOKBtn = xDialog.getChild("ok")
+ UITestCase.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab: