summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-24 01:53:06 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-24 02:40:43 +0200
commit9a89eea4c3c58d2efce8afe709c0317869839ff9 (patch)
treef235036802674593f9cf6253f2f6363664494233 /uitest
parent6805efdecb240fad8c82a5c1756a2a0e92f12b7d (diff)
Revert "uitest: guard create_doc_in_start_center"
This reverts commit 374baf308979306aa35575118c40ccd7caae1e29. Many uitests are failing randomly in jenkins for no apparent reason Change-Id: I5960330fab4967518bfeea32b3b8c5f8bfbea57e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117752 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, 445 insertions, 376 deletions
diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py
index c261dda1e3a9..5dd0212ee719 100644
--- a/uitest/demo_ui/char_dialog.py
+++ b/uitest/demo_ui/char_dialog.py
@@ -11,16 +11,18 @@ from uitest.framework import UITestCase
class CharDialogText(UITestCase):
def test_select_char(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ xCancelBtn = xCharDialog.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/checkbox.py b/uitest/demo_ui/checkbox.py
index fd2a649b4a28..114473d53851 100644
--- a/uitest/demo_ui/checkbox.py
+++ b/uitest/demo_ui/checkbox.py
@@ -13,14 +13,16 @@ class CheckBoxTest(UITestCase):
def test_toggle_checkbox(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
+
+ 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 f8c7ad9413cf..8b47f8338fb9 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -14,15 +14,17 @@ class ComboBoxTest(UITestCase):
def test_select_entry_pos(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ 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 689415207e3b..c82d3359559a 100644
--- a/uitest/demo_ui/command_with_parameters.py
+++ b/uitest/demo_ui/command_with_parameters.py
@@ -12,11 +12,13 @@ class CommandWithParametersTest(UITestCase):
def test_text_color_change(self):
- with self.ui_test.create_doc_in_start_center("writer"):
+ 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.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 0dcc82093fa0..48ada3b1d15e 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -16,36 +16,40 @@ class EditTest(UITestCase):
def test_type_text(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ xAddBtn = xAddNameDlg.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xAddBtn)
+
+ self.ui_test.close_doc()
def test_select_text(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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")
+ 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 98d4c9c91fd0..ddfb13273bb8 100644
--- a/uitest/demo_ui/gridwin.py
+++ b/uitest/demo_ui/gridwin.py
@@ -13,33 +13,39 @@ class GridWinTest(UITestCase):
def test_select_cell(self):
- with self.ui_test.create_doc_in_start_center("calc"):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
+ 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)
+ selectProps = mkPropertyValues({"CELL": "B10"})
+ xGridWindow.executeAction("SELECT", selectProps)
+
+ self.ui_test.close_doc()
def test_select_range(self):
- with self.ui_test.create_doc_in_start_center("calc"):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
+ 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)
- selectProps = mkPropertyValues({"RANGE": "B10:C20"})
- xGridWindow.executeAction("SELECT", selectProps)
+ self.ui_test.close_doc()
def test_extend_range(self):
- with self.ui_test.create_doc_in_start_center("calc"):
- xTopWindow = self.xUITest.getTopFocusWindow()
+ self.ui_test.create_doc_in_start_center("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 31f123cef230..f5434366fda4 100644
--- a/uitest/demo_ui/hierarchy.py
+++ b/uitest/demo_ui/hierarchy.py
@@ -15,19 +15,21 @@ class CheckBoxTest(UITestCase):
def test_get_json(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ closeBtn = xAboutDlg.getChild("btnClose")
+ self.ui_test.close_dialog_through_button(closeBtn)
+
+ 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 4bce5c2ba258..7e9ae16e6543 100644
--- a/uitest/demo_ui/listbox.py
+++ b/uitest/demo_ui/listbox.py
@@ -14,22 +14,26 @@ class ListBoxTest(UITestCase):
def test_select_entry_pos(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ self.ui_test.close_doc()
def test_select_entry_text(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ 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 f8d49587b0e0..bb2f5bd07440 100644
--- a/uitest/demo_ui/radiobutton.py
+++ b/uitest/demo_ui/radiobutton.py
@@ -25,14 +25,16 @@ class RadioButtonTest(UITestCase):
def test_toggle_radiobutton(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
+
+ 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 9469bc9254d1..a74e47206274 100644
--- a/uitest/demo_ui/spinfield.py
+++ b/uitest/demo_ui/spinfield.py
@@ -14,56 +14,62 @@ class SpinFieldTest(UITestCase):
def test_up(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
+
+ self.ui_test.close_doc()
def test_down(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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())
+ 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")
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ self.ui_test.close_doc()
def test_text(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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")
+ 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")
+ okBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
- okBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ 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 4da9e8ee9782..47b3f33a3cf4 100644
--- a/uitest/demo_ui/tabcontrol.py
+++ b/uitest/demo_ui/tabcontrol.py
@@ -16,21 +16,23 @@ class TabControlTest(UITestCase):
def test_select_pos(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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())
+ 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 00e9c0e161b8..861b270989d9 100644
--- a/uitest/demo_ui/tabdialog.py
+++ b/uitest/demo_ui/tabdialog.py
@@ -14,22 +14,26 @@ class TabDialogTest(UITestCase):
def test_select_tab_page_pos(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
+ xOkBtn = xCellsDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ self.ui_test.close_doc()
def test_select_tab_page_name(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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)
- xOkBtn = xCellsDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ 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 ad8246c5184a..265fa8b975b3 100644
--- a/uitest/demo_ui/treelist.py
+++ b/uitest/demo_ui/treelist.py
@@ -16,29 +16,31 @@ class TreeListTest(UITestCase):
def test_expand(self):
- with self.ui_test.create_doc_in_start_center("calc"):
+ 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())
+ 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 a98e8a33f71c..123c7ef81021 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -105,42 +105,44 @@ class ImpressBackgrounds(UITestCase):
def test_background_dialog(self):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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.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 4e2f33d45604..7b33e369d2e6 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -13,146 +13,152 @@ from uitest.framework import UITestCase
class ImpressDrawinglayerTest(UITestCase):
def test_move_object(self):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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.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):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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(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)
- 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)
+ 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())
+ 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('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('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
- self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
- self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
- self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- 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.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):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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()
+ 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)
- 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)
+ 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())
+ 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('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
- self.assertEqual('30', 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.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 f18321e4d076..ebbe8e2ec266 100644
--- a/uitest/impress_tests/layouts.py
+++ b/uitest/impress_tests/layouts.py
@@ -11,31 +11,33 @@ class ImpressLayouts(UITestCase):
def test_impress_layouts(self):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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())
+ # 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 11e82d6a9f3d..b6f5cbc517c9 100644
--- a/uitest/impress_tests/start.py
+++ b/uitest/impress_tests/start.py
@@ -12,39 +12,43 @@ from uitest.framework import UITestCase
class SimpleImpressTest(UITestCase):
def test_start_impress(self):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200")
+
+ self.ui_test.close_doc()
def test_select_page(self):
- with self.ui_test.create_doc_in_start_center("impress"):
+ 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 = 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 9d1e51df69f7..2ad977f73917 100644
--- a/uitest/math_tests/start.py
+++ b/uitest/math_tests/start.py
@@ -18,64 +18,74 @@ class SimpleMathTest(UITestCase):
def test_start_math(self):
- with self.ui_test.create_doc_in_start_center("math"):
+ self.ui_test.create_doc_in_start_center("math")
- xMathDoc = self.xUITest.getTopFocusWindow()
+ xMathDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.close_doc()
def test_docking_window_listbox(self):
- with self.ui_test.create_doc_in_start_center("math"):
+ self.ui_test.create_doc_in_start_center("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):
- with self.ui_test.create_doc_in_start_center("math"):
+ self.ui_test.create_doc_in_start_center("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):
- with self.ui_test.create_doc_in_start_center("math"):
+ 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())
+ 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):
- with self.ui_test.create_doc_in_start_center("math"):
+ self.ui_test.create_doc_in_start_center("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/test.py b/uitest/uitest/test.py
index 29af1e0899c2..c601116d2a6b 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -154,8 +154,6 @@ 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:
@@ -174,10 +172,6 @@ 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 1cc6d3cca7e6..5cfed2d49e1a 100644
--- a/uitest/uitest/uihelper/guarded.py
+++ b/uitest/uitest/uihelper/guarded.py
@@ -9,6 +9,16 @@
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 d1cf007fa0cb..43f0a5bc0794 100644
--- a/uitest/uitest/uihelper/testDialog.py
+++ b/uitest/uitest/uihelper/testDialog.py
@@ -12,27 +12,28 @@ 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):
- with UITestCase.ui_test.create_doc_in_start_center(app):
- UITestCase.ui_test.execute_dialog_through_command(dialog['command'])
- xDialog = UITestCase.xUITest.getTopFocusWindow()
+ doc = 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_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()
# vim: set shiftwidth=4 softtabstop=4 expandtab: