summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 12:09:34 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 15:26:57 +0200
commita564bb70ad6c19b28c553625f4781655adb80702 (patch)
tree9a4be5c7a79d29471fa1076ba6563440587b0fec /uitest
parent95b06d3aa514ce83f82fd538d1731fc6363e4b8a (diff)
uitest: combine create_doc_in_start_center methods
Change-Id: I59ea0d0dbd203590e7cedec51d0481c953e5172b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118155 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/demo_ui/char_dialog.py2
-rw-r--r--uitest/demo_ui/checkbox.py2
-rw-r--r--uitest/demo_ui/combobox.py2
-rw-r--r--uitest/demo_ui/command_with_parameters.py2
-rw-r--r--uitest/demo_ui/edit.py4
-rw-r--r--uitest/demo_ui/gridwin.py6
-rw-r--r--uitest/demo_ui/hierarchy.py2
-rw-r--r--uitest/demo_ui/listbox.py4
-rw-r--r--uitest/demo_ui/radiobutton.py2
-rw-r--r--uitest/demo_ui/spinfield.py6
-rw-r--r--uitest/demo_ui/tabcontrol.py2
-rw-r--r--uitest/demo_ui/tabdialog.py4
-rw-r--r--uitest/demo_ui/treelist.py2
-rw-r--r--uitest/impress_tests/backgrounds.py2
-rw-r--r--uitest/impress_tests/drawinglayer.py6
-rw-r--r--uitest/impress_tests/layouts.py2
-rw-r--r--uitest/impress_tests/start.py4
-rw-r--r--uitest/math_tests/start.py10
-rw-r--r--uitest/uitest/test.py17
-rw-r--r--uitest/uitest/uihelper/testDialog.py2
20 files changed, 39 insertions, 44 deletions
diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py
index 1f231c3b39c3..c5c4668f7821 100644
--- a/uitest/demo_ui/char_dialog.py
+++ b/uitest/demo_ui/char_dialog.py
@@ -11,7 +11,7 @@ from uitest.framework import UITestCase
class CharDialogText(UITestCase):
def test_select_char(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xCharDialog:
diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py
index d944b62d37d4..23d065595fee 100644
--- a/uitest/demo_ui/checkbox.py
+++ b/uitest/demo_ui/checkbox.py
@@ -13,7 +13,7 @@ class CheckBoxTest(UITestCase):
def test_toggle_checkbox(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py
index 924b5c3af035..50aa2b40d6ff 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -14,7 +14,7 @@ class ComboBoxTest(UITestCase):
def test_select_entry_pos(self):
- with self.ui_test.create_doc_in_start_center_guarded("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()
diff --git a/uitest/demo_ui/command_with_parameters.py b/uitest/demo_ui/command_with_parameters.py
index 3a140643b659..4d42f710f584 100644
--- a/uitest/demo_ui/command_with_parameters.py
+++ b/uitest/demo_ui/command_with_parameters.py
@@ -12,7 +12,7 @@ class CommandWithParametersTest(UITestCase):
def test_text_color_change(self):
- with self.ui_test.create_doc_in_start_center_guarded("writer"):
+ with self.ui_test.create_doc_in_start_center("writer"):
self.xUITest.executeCommandWithParameters(".uno:Color",
mkPropertyValues({"Color": 16776960}))
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 7007c07b4a90..75d20b6afc6f 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -16,7 +16,7 @@ class EditTest(UITestCase):
def test_type_text(self):
- with self.ui_test.create_doc_in_start_center_guarded("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()
@@ -31,7 +31,7 @@ class EditTest(UITestCase):
def test_select_text(self):
- with self.ui_test.create_doc_in_start_center_guarded("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()
diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py
index 142c395f22c9..12131182431a 100644
--- a/uitest/demo_ui/gridwin.py
+++ b/uitest/demo_ui/gridwin.py
@@ -13,7 +13,7 @@ class GridWinTest(UITestCase):
def test_select_cell(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")
@@ -23,7 +23,7 @@ class GridWinTest(UITestCase):
def test_select_range(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")
@@ -33,7 +33,7 @@ class GridWinTest(UITestCase):
def test_extend_range(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
xTopWindow = self.xUITest.getTopFocusWindow()
xGridWindow = xTopWindow.getChild("grid_window")
diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py
index b17626a108ca..17c81d5733f0 100644
--- a/uitest/demo_ui/hierarchy.py
+++ b/uitest/demo_ui/hierarchy.py
@@ -15,7 +15,7 @@ class CheckBoxTest(UITestCase):
def test_get_json(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose") as xAboutDlg:
diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py
index 6a1a075d35f4..852d2a771070 100644
--- a/uitest/demo_ui/listbox.py
+++ b/uitest/demo_ui/listbox.py
@@ -14,7 +14,7 @@ class ListBoxTest(UITestCase):
def test_select_entry_pos(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
pass
@@ -22,7 +22,7 @@ class ListBoxTest(UITestCase):
def test_select_entry_text(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
pass
diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py
index 628cf2a38834..91a7f95effe9 100644
--- a/uitest/demo_ui/radiobutton.py
+++ b/uitest/demo_ui/radiobutton.py
@@ -25,7 +25,7 @@ class RadioButtonTest(UITestCase):
def test_toggle_radiobutton(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
xNegativeNumRedCB = xCellsDlg.getChild("negnumred")
diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py
index bed26702122b..351223794caf 100644
--- a/uitest/demo_ui/spinfield.py
+++ b/uitest/demo_ui/spinfield.py
@@ -14,7 +14,7 @@ class SpinFieldTest(UITestCase):
def test_up(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
@@ -28,7 +28,7 @@ class SpinFieldTest(UITestCase):
def test_down(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
@@ -48,7 +48,7 @@ class SpinFieldTest(UITestCase):
def test_text(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xCellsDlg:
diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py
index f47c51f8303c..eb93339eb391 100644
--- a/uitest/demo_ui/tabcontrol.py
+++ b/uitest/demo_ui/tabcontrol.py
@@ -16,7 +16,7 @@ class TabControlTest(UITestCase):
def test_select_pos(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")
diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py
index e3fde961f014..6aadf13f73a9 100644
--- a/uitest/demo_ui/tabdialog.py
+++ b/uitest/demo_ui/tabdialog.py
@@ -14,7 +14,7 @@ class TabDialogTest(UITestCase):
def test_select_tab_page_pos(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
pass
@@ -22,7 +22,7 @@ class TabDialogTest(UITestCase):
def test_select_tab_page_name(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog"):
pass
diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py
index 20331230df08..baea77cf4ef6 100644
--- a/uitest/demo_ui/treelist.py
+++ b/uitest/demo_ui/treelist.py
@@ -16,7 +16,7 @@ class TreeListTest(UITestCase):
def test_expand(self):
- with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py
index 256878926967..e02c708aa396 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -105,7 +105,7 @@ class ImpressBackgrounds(UITestCase):
def test_background_dialog(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress"):
+ with self.ui_test.create_doc_in_start_center("impress"):
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index 93edd5503df7..9f193d3cfb41 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -13,7 +13,7 @@ from uitest.framework import UITestCase
class ImpressDrawinglayerTest(UITestCase):
def test_move_object(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress") as document:
+ with self.ui_test.create_doc_in_start_center("impress") as document:
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
@@ -56,7 +56,7 @@ class ImpressDrawinglayerTest(UITestCase):
def test_resize_object(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress") as document:
+ with self.ui_test.create_doc_in_start_center("impress") as document:
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
@@ -99,7 +99,7 @@ class ImpressDrawinglayerTest(UITestCase):
def test_rotate_object(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress") as document:
+ with self.ui_test.create_doc_in_start_center("impress") as document:
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
diff --git a/uitest/impress_tests/layouts.py b/uitest/impress_tests/layouts.py
index 1c7c3b43bf8c..fbd0bd8d88b5 100644
--- a/uitest/impress_tests/layouts.py
+++ b/uitest/impress_tests/layouts.py
@@ -11,7 +11,7 @@ class ImpressLayouts(UITestCase):
def test_impress_layouts(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress"):
+ with self.ui_test.create_doc_in_start_center("impress"):
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
diff --git a/uitest/impress_tests/start.py b/uitest/impress_tests/start.py
index f9e51cf249d8..6d6563307d61 100644
--- a/uitest/impress_tests/start.py
+++ b/uitest/impress_tests/start.py
@@ -12,7 +12,7 @@ from uitest.framework import UITestCase
class SimpleImpressTest(UITestCase):
def test_start_impress(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress"):
+ with self.ui_test.create_doc_in_start_center("impress"):
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
@@ -28,7 +28,7 @@ class SimpleImpressTest(UITestCase):
def test_select_page(self):
- with self.ui_test.create_doc_in_start_center_guarded("impress"):
+ with self.ui_test.create_doc_in_start_center("impress"):
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py
index 700e38c7c87d..4645dff920da 100644
--- a/uitest/math_tests/start.py
+++ b/uitest/math_tests/start.py
@@ -18,14 +18,14 @@ class SimpleMathTest(UITestCase):
def test_start_math(self):
- with self.ui_test.create_doc_in_start_center_guarded("math"):
+ with self.ui_test.create_doc_in_start_center("math"):
xMathDoc = self.xUITest.getTopFocusWindow()
def test_docking_window_listbox(self):
- with self.ui_test.create_doc_in_start_center_guarded("math"):
+ with self.ui_test.create_doc_in_start_center("math"):
xMathDoc = self.xUITest.getTopFocusWindow()
@@ -38,7 +38,7 @@ class SimpleMathTest(UITestCase):
def test_math_edit(self):
- with self.ui_test.create_doc_in_start_center_guarded("math"):
+ with self.ui_test.create_doc_in_start_center("math"):
xMathDoc = self.xUITest.getTopFocusWindow()
@@ -48,7 +48,7 @@ class SimpleMathTest(UITestCase):
def test_math_selector(self):
- with self.ui_test.create_doc_in_start_center_guarded("math"):
+ with self.ui_test.create_doc_in_start_center("math"):
xMathDoc = self.xUITest.getTopFocusWindow()
@@ -60,7 +60,7 @@ class SimpleMathTest(UITestCase):
@unittest.skip("on windows the f4 does not always work")
def test_complete_math(self):
- with self.ui_test.create_doc_in_start_center_guarded("math"):
+ with self.ui_test.create_doc_in_start_center("math"):
xMathDoc = self.xUITest.getTopFocusWindow()
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 15cdce4654f0..c1688f84be96 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -177,14 +177,6 @@ class UITest(object):
# Calls UITest.close_doc at exit
@contextmanager
- def create_doc_in_start_center_guarded(self, app):
- self.create_doc_in_start_center(app)
- component = self.get_component()
- try:
- yield component
- finally:
- self.close_doc()
-
def create_doc_in_start_center(self, app):
xStartCenter = self._xUITest.getTopFocusWindow()
try:
@@ -203,13 +195,16 @@ class UITest(object):
if event.executed:
frames = self.get_frames()
self.get_desktop().setActiveFrame(frames[0])
+ component = self.get_component()
+ try:
+ yield component
+ finally:
+ self.close_doc()
return
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
- print("failure doc in start center")
-
- # report a failure here
+ raise Exception("Failure doc in start center")
def close_dialog_through_button(self, button):
with EventListener(self._xContext, "DialogClosed" ) as event:
diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py
index 828f1ca6b07f..0e443643645f 100644
--- a/uitest/uitest/uihelper/testDialog.py
+++ b/uitest/uitest/uihelper/testDialog.py
@@ -12,7 +12,7 @@ from uitest.uihelper.common import get_state_as_dict
# and if there is an "OK" button open the dialog again and close it by using the OK button
# the test only checks if LibreOffice crashes by opening the dialog
def testDialog(UITestCase, app, dialog):
- with UITestCase.ui_test.create_doc_in_start_center_guarded(app):
+ with UITestCase.ui_test.create_doc_in_start_center(app):
with UITestCase.ui_test.execute_dialog_through_command(dialog['command'], close_button=dialog['closeButton']) as xDialog:
if 'skipTestOK' in dialog and dialog['skipTestOK'] == True:
xOKBtn = None