diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-30 11:57:03 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-30 13:18:38 +0200 |
commit | 3874e092da4acbaa076d885444f26f014fd781b5 (patch) | |
tree | 8342124c5325ad188f9b4be87052c4a884af560e /uitest/math_tests | |
parent | 57e8d25a40d7c053fef8ecb452e159264c659604 (diff) |
uitest: guard the remaining create_doc_in_start_center
Mostly done by a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: I2a6149b318d1fdaa36efe5d65af4c238827eaaf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118154
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest/math_tests')
-rw-r--r-- | uitest/math_tests/start.py | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py index 2ad977f73917..700e38c7c87d 100644 --- a/uitest/math_tests/start.py +++ b/uitest/math_tests/start.py @@ -18,74 +18,69 @@ class SimpleMathTest(UITestCase): def test_start_math(self): - self.ui_test.create_doc_in_start_center("math") + with self.ui_test.create_doc_in_start_center_guarded("math"): - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - self.ui_test.close_doc() def test_docking_window_listbox(self): - self.ui_test.create_doc_in_start_center("math") + with self.ui_test.create_doc_in_start_center_guarded("math"): - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - xList = xMathDoc.getChild("listbox") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - select_pos(xList, "1") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Relations") + xList = xMathDoc.getChild("listbox") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") + select_pos(xList, "1") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Relations") - self.ui_test.close_doc() def test_math_edit(self): - self.ui_test.create_doc_in_start_center("math") + with self.ui_test.create_doc_in_start_center_guarded("math"): - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - xMathEdit = xMathDoc.getChild("math_edit") + xMathEdit = xMathDoc.getChild("math_edit") - type_text(xMathEdit, "E=mc^2") + type_text(xMathEdit, "E=mc^2") - self.ui_test.close_doc() def test_math_selector(self): - self.ui_test.create_doc_in_start_center("math") + with self.ui_test.create_doc_in_start_center_guarded("math"): - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - xMathSelector = xMathDoc.getChild("element_selector") + xMathSelector = xMathDoc.getChild("element_selector") - xElement = xMathSelector.getChild("1") - xElement.executeAction("SELECT", tuple()) + xElement = xMathSelector.getChild("1") + xElement.executeAction("SELECT", tuple()) - self.ui_test.close_doc() @unittest.skip("on windows the f4 does not always work") def test_complete_math(self): - self.ui_test.create_doc_in_start_center("math") + with self.ui_test.create_doc_in_start_center_guarded("math"): - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - xList = xMathDoc.getChild("listbox") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - select_pos(xList, "1") + xList = xMathDoc.getChild("listbox") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") + select_pos(xList, "1") - xMathSelector = xMathDoc.getChild("element_selector") + xMathSelector = xMathDoc.getChild("element_selector") - xElement = xMathSelector.getChild("1") - xElement.executeAction("SELECT", tuple()) + xElement = xMathSelector.getChild("1") + xElement.executeAction("SELECT", tuple()) - xMathEdit = xMathDoc.getChild("math_edit") - type_text(xMathEdit, "1") - xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) - type_text(xMathEdit, "2") + xMathEdit = xMathDoc.getChild("math_edit") + type_text(xMathEdit, "1") + xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) + type_text(xMathEdit, "2") - edit_state = get_state_as_dict(xMathEdit) - self.assertEqual("1 <> 2 ", edit_state["Text"]) + edit_state = get_state_as_dict(xMathEdit) + self.assertEqual("1 <> 2 ", edit_state["Text"]) - self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |