diff options
Diffstat (limited to 'sc/qa/uitest/search_replace/replace.py')
-rw-r--r-- | sc/qa/uitest/search_replace/replace.py | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py index 867482fbeaea..2a6d2a3cd424 100644 --- a/sc/qa/uitest/search_replace/replace.py +++ b/sc/qa/uitest/search_replace/replace.py @@ -12,48 +12,47 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class ReplaceTest(UITestCase): def test_tdf106194(self): - doc = self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")) + with self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")) as doc: - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xSearchDlg = self.xUITest.getTopFocusWindow() + xSearchDlg = self.xUITest.getTopFocusWindow() - xSearchTerm = xSearchDlg.getChild("searchterm") - xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) - xReplaceTerm = xSearchDlg.getChild("replaceterm") - xReplaceTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xSearchTerm = xSearchDlg.getChild("searchterm") + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xReplaceTerm = xSearchDlg.getChild("replaceterm") + xReplaceTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) - xSearchBtn = xSearchDlg.getChild("search") - xSearchBtn.executeAction("CLICK", tuple()) + xSearchBtn = xSearchDlg.getChild("search") + xSearchBtn.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") - lastTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") + lastTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - # start replacing - xReplaceBtn = xSearchDlg.getChild("replace") - xReplaceBtn.executeAction("CLICK", tuple()) + # start replacing + xReplaceBtn = xSearchDlg.getChild("replace") + xReplaceBtn.executeAction("CLICK", tuple()) - # check position and visible range - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "199") - currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "199") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) - lastTopVisibleRow = currentTopVisibleRow + lastTopVisibleRow = currentTopVisibleRow - # replace again - xReplaceBtn.executeAction("CLICK", tuple()) + # replace again + xReplaceBtn.executeAction("CLICK", tuple()) - # check position and visible range - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "499") - currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "499") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) - xReplaceBtn.executeAction("CLICK", tuple()) + xReplaceBtn.executeAction("CLICK", tuple()) - xCloseBtn = xSearchDlg.getChild("close") + xCloseBtn = xSearchDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_dialog_through_button(xCloseBtn) - self.ui_test.close_doc() |