summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/search_replace
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/uitest/search_replace')
-rw-r--r--sc/qa/uitest/search_replace/replace.py56
-rw-r--r--sc/qa/uitest/search_replace/tdf132097.py35
-rw-r--r--sc/qa/uitest/search_replace/tdf132783.py32
-rw-r--r--sc/qa/uitest/search_replace/tdf143759.py58
-rw-r--r--sc/qa/uitest/search_replace/tdf35020.py41
-rw-r--r--sc/qa/uitest/search_replace/tdf39917.py80
-rw-r--r--sc/qa/uitest/search_replace/tdf39959.py43
-rw-r--r--sc/qa/uitest/search_replace/tdf44398.py91
-rw-r--r--sc/qa/uitest/search_replace/tdf44861.py49
-rw-r--r--sc/qa/uitest/search_replace/tdf57523.py59
-rw-r--r--sc/qa/uitest/search_replace/tdf65334.py75
-rw-r--r--sc/qa/uitest/search_replace/tdf83126.py58
12 files changed, 677 insertions, 0 deletions
diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py
new file mode 100644
index 0000000000..bb9afa65ce
--- /dev/null
+++ b/sc/qa/uitest/search_replace/replace.py
@@ -0,0 +1,56 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class ReplaceTest(UITestCase):
+
+ def test_tdf106194(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")):
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xSearchDlg:
+
+
+ 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())
+
+ 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())
+
+ # 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
+
+ # 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)
+
+ xReplaceBtn.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf132097.py b/sc/qa/uitest/search_replace/tdf132097.py
new file mode 100644
index 0000000000..6fe09754ac
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf132097.py
@@ -0,0 +1,35 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf132097(UITestCase):
+
+ def test_tdf132097(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ xCols = xDialog.getChild('cols')
+ xSearchTerm = xDialog.getChild("searchterm")
+ xBackSearch = xDialog.getChild("backsearch")
+ xSeachLabel = xDialog.getChild("searchlabel")
+
+ xCols.executeAction("CLICK", tuple())
+ xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"}))
+
+ for i in range(10):
+ # without the fix in place it would crash here.
+ # Sometimes it doesn't crash at first so try a few times to be sure
+ xBackSearch.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf132783.py b/sc/qa/uitest/search_replace/tdf132783.py
new file mode 100644
index 0000000000..5c28e47970
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf132783.py
@@ -0,0 +1,32 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf132783(UITestCase):
+
+ def test_tdf132783(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf132783.ods")):
+
+ for i in range(5):
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ xSearchTerm = xDialog.getChild("searchterm")
+
+ xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+
+ xSearch = xDialog.getChild("search")
+ xSearch.executeAction("CLICK", tuple())
+
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], str( 96 + i))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf143759.py b/sc/qa/uitest/search_replace/tdf143759.py
new file mode 100644
index 0000000000..351d141f99
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf143759.py
@@ -0,0 +1,58 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+
+class tdf143759(UITestCase):
+
+ def test_tdf143759(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ enter_text_to_cell(gridwin, "C2", "A")
+ enter_text_to_cell(gridwin, "E3", "1")
+ enter_text_to_cell(gridwin, "B5", "2")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F6"}))
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+
+ # More Options is expanded when there is a selection with data
+ xExpander = xDialog.getChild("OptionsExpander")
+ self.assertEqual("true", get_state_as_dict(xExpander)['Expanded'])
+
+ xSearchterm = xDialog.getChild("searchterm")
+ xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"}))
+
+ xRegexp = xDialog.getChild("regexp")
+ xRegexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xRegexp)['Selected'])
+
+ xSelection = xDialog.getChild("selection")
+ if get_state_as_dict(xSelection)['Selected'] == 'false':
+ xSelection.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xSelection)['Selected'])
+
+ xSearchall = xDialog.getChild("searchall")
+ with self.ui_test.execute_dialog_through_action(
+ xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as dialog:
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 13 != 0
+ self.assertEqual(13, len(dialog.getChild("results").getChildren()))
+
+ # Deselect regex button, otherwise it might affect other tests
+ xRegexp.executeAction("CLICK", tuple())
+ self.assertEqual("false", get_state_as_dict(xRegexp)['Selected'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf35020.py b/sc/qa/uitest/search_replace/tdf35020.py
new file mode 100644
index 0000000000..bf04661411
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf35020.py
@@ -0,0 +1,41 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 35020 - Find and Replace changes case of sheet name in formulas
+class tdf35020(UITestCase):
+ def test_tdf39959_find_replace_all_sheets(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf35020.ods")) as calc_doc:
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"X6"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) #replace textbox
+ allsheets = xDialog.getChild("allsheets")
+ allsheets.executeAction("CLICK", tuple())
+ calcsearchin = xDialog.getChild("calcsearchin")
+ self.assertEqual("Formulas", get_state_as_dict(calcsearchin)['SelectEntryText'])
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ #verify Sheet1.A13 A14 = 2
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 2)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getValue(), 2)
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 1)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getValue(), 1)
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf39917.py b/sc/qa/uitest/search_replace/tdf39917.py
new file mode 100644
index 0000000000..3a0b064674
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf39917.py
@@ -0,0 +1,80 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import select_by_text
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+# Bug 39917 - EDITING Find/Replace modifies formula in R1C1 syntax to invalid lowercase
+class tdf39917(UITestCase):
+ def change_formula_syntax(self, syntax):
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt:
+
+ xPages = xDialogOpt.getChild("pages")
+ xCalcEntry = xPages.getChild('3')
+ xCalcEntry.executeAction("EXPAND", tuple())
+ xCalcFormulaEntry = xCalcEntry.getChild('4')
+ xCalcFormulaEntry.executeAction("SELECT", tuple())
+
+ xFormulaSyntax = xDialogOpt.getChild('formulasyntax')
+ select_by_text(xFormulaSyntax, syntax)
+
+ def test_tdf39917_find_replace_R1C1(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ try:
+ self.change_formula_syntax("Excel R1C1")
+
+ #1. Create a workbook with 3 sheets: Page1, Page2, Page3.
+ # 2. Tools -> Options -> LibreOffice Calc -> Formula: Set syntax to Excel A1
+ # 5. Fill fields:
+
+ with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog:
+ after = xDialog.getChild("after")
+ after.executeAction("CLICK", tuple())
+ nameed = xDialog.getChild("nameed")
+ nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"}))
+ with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog:
+ after = xDialog.getChild("after")
+ after.executeAction("CLICK", tuple())
+ nameed = xDialog.getChild("nameed")
+ nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"}))
+ # 3. Type in (for example) B4: =Page2!B4
+ enter_text_to_cell(gridwin, "B4", "=Page2!RC")
+ # 4. Edit -> Find and Replace
+ # Find: Page2
+ # Replace: Page3
+ # 6. Press Replace all
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox
+ replace = xDialog.getChild("replace")
+ replace.executeAction("CLICK", tuple())
+ replace.executeAction("CLICK", tuple())
+
+ #verify
+ enter_text_to_cell(gridwin, "A1", "=FORMULA(R[3]C[1])")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=Page3!RC")
+ finally:
+ self.change_formula_syntax("Calc A1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf39959.py b/sc/qa/uitest/search_replace/tdf39959.py
new file mode 100644
index 0000000000..f08019ab0a
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf39959.py
@@ -0,0 +1,43 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 39959 - Find-and-replace doesn't search all tables anymore
+class tdf39959(UITestCase):
+ def test_tdf39959_find_replace_all_sheets(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf39959.ods")) as calc_doc:
+ # 1. Open a new document
+ # 2. Enter "asdf" in A1
+ # 3. Activate Sheet2
+ # 4. Try Find-and-replace (Ctrl+Alt+F) to search for "asdf"
+ # Whether the checkbox "in allen Tabellen suchen" is activated or not: LibO Calc never seems to find the text
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"asdf"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bbb"})) #replace textbox
+ allsheets = xDialog.getChild("allsheets")
+ allsheets.executeAction("CLICK", tuple())
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ #verify Sheet2.A1 = "bbb"
+ self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 0).getString(), "bbb ")
+ self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 2).getString(), "abc")
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 0).getString(), "asdf ")
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf44398.py b/sc/qa/uitest/search_replace/tdf44398.py
new file mode 100644
index 0000000000..0fe70817a0
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf44398.py
@@ -0,0 +1,91 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 44398 - : Find, replace, regular expression bug
+class tdf44398(UITestCase):
+ def test_tdf44398_find_replace_regexp(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ # 1. A1 => 123456
+ enter_text_to_cell(gridwin, "A1", "123456")
+ # 2. ctrl-h, in dialog
+ # Search: ([0-9])
+ # Replace: $1
+ # check regular expression
+ # hit replace all
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox
+ regexp = xDialog.getChild("regexp")
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ # Deselect regex button, otherwise it might affect other tests
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
+
+ #verify 3. A1 => 123456
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456")
+
+
+ def test_tdf44398_find_replace_regexp_string(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ # 1. A1 => VarNumberA
+ enter_text_to_cell(gridwin, "A1", "VarNumberA")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"}))
+ # 2. ctrl-h, in dialog
+ # Search: ([A-Z])
+ # Replace: <space>$1
+ # check regular expression
+ # check case
+ # hit replace all
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox
+ regexp = xDialog.getChild("regexp")
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
+ matchcase = xDialog.getChild("matchcase")
+ matchcase.executeAction("CLICK", tuple()) #case
+
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ # Deselect regex button, otherwise it might affect other tests
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
+
+ #verify A1 => ' Var Number A'
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf44861.py b/sc/qa/uitest/search_replace/tdf44861.py
new file mode 100644
index 0000000000..7f0b213617
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf44861.py
@@ -0,0 +1,49 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 44861 - EDITING: result 'Find&Replace All' wrong for particular Regular Expression
+class tdf44861(UITestCase):
+ def test_tdf44861_find_replaceAll_regexp(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf44861.ods")) as calc_doc:
+ # 2. ctrl-h, in dialog
+ # Search: ([0-9]{2})([0-9]{2})
+ # Replace: $1.$2
+ # check option "Enable regular expressions"
+ # Press "Replace all"
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9]{2})([0-9]{2})"}))
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1.$2"})) #replace textbox
+ regexp = xDialog.getChild("regexp")
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ # Deselect regex button, otherwise it might affect other tests
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
+
+ #Expected: instead of 1345-1430 appears 13.45-14.30
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "13.45-14.30")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "13.45-14.30")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "14.50-15.30")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "12.55-13.35")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "12.30-13.40")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf57523.py b/sc/qa/uitest/search_replace/tdf57523.py
new file mode 100644
index 0000000000..f753a7a8a0
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf57523.py
@@ -0,0 +1,59 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+
+class tdf57523(UITestCase):
+
+ def test_tdf57523(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ enter_text_to_cell(gridwin, "A1", "AAA")
+ enter_text_to_cell(gridwin, "A4", "AAA")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+
+ # More Options is expanded when there is a selection with data
+ xExpander = xDialog.getChild("OptionsExpander")
+ self.assertEqual("true", get_state_as_dict(xExpander)['Expanded'])
+
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"}))
+
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"}))
+ regexp = xDialog.getChild("regexp")
+
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(regexp)['Selected'])
+
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+
+ # Deselect regex button, otherwise it might affect other tests
+ regexp.executeAction("CLICK", tuple())
+ self.assertEqual("false", get_state_as_dict(regexp)['Selected'])
+
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '' != 'BBB'
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf65334.py b/sc/qa/uitest/search_replace/tdf65334.py
new file mode 100644
index 0000000000..855fb47a45
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf65334.py
@@ -0,0 +1,75 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.calc import enter_text_to_cell
+
+class tdf65334(UITestCase):
+
+ def test_tdf65334(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"}))
+
+ # Insert a comment in a cell without text
+ xArgs = mkPropertyValues({"Text": "Comment 1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+ # Insert a comment in a cell with text
+ enter_text_to_cell(gridwin, "C10", "Cell with text")
+ xArgs = mkPropertyValues({"Text": "Comment 2"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ xExpander = xDialog.getChild("OptionsExpander")
+
+ # tdf#129629: Without the fix in place, this test would have failed with
+ # AssertionError: 'false' != 'true'
+ self.assertEqual("false", get_state_as_dict(xExpander)['Expanded'])
+
+ xExpander.executeAction("EXPAND", tuple())
+ self.assertEqual("true", get_state_as_dict(xExpander)['Expanded'])
+
+ xCalcsearchin = xDialog.getChild("calcsearchin")
+ select_by_text(xCalcsearchin, "Comments")
+
+ xSearchterm = xDialog.getChild("searchterm")
+ xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Comment"}))
+
+ xSearch = xDialog.getChild("search")
+ xSearch.executeAction("CLICK", tuple())
+
+ self.assertEqual("0", get_state_as_dict(gridwin)["CurrentColumn"])
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '4' != '0'
+ self.assertEqual("4", get_state_as_dict(gridwin)["CurrentRow"])
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ xSearchterm = xDialog.getChild("searchterm")
+ xCalcsearchin = xDialog.getChild("calcsearchin")
+ xExpander = xDialog.getChild("OptionsExpander")
+
+ self.assertEqual("false", get_state_as_dict(xExpander)['Expanded'])
+ self.assertEqual("Comment", get_state_as_dict(xSearchterm)['Text'])
+ self.assertEqual("Comments", get_state_as_dict(xCalcsearchin)['SelectEntryText'])
+
+ xSearch = xDialog.getChild("search")
+ xSearch.executeAction("CLICK", tuple())
+
+ self.assertEqual("2", get_state_as_dict(gridwin)["CurrentColumn"])
+ self.assertEqual("9", get_state_as_dict(gridwin)["CurrentRow"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf83126.py b/sc/qa/uitest/search_replace/tdf83126.py
new file mode 100644
index 0000000000..818b688f72
--- /dev/null
+++ b/sc/qa/uitest/search_replace/tdf83126.py
@@ -0,0 +1,58 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+
+class tdf83126(UITestCase):
+
+ def test_tdf132097(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ enter_text_to_cell(gridwin, "A4", "Test")
+ enter_text_to_cell(gridwin, "D1", "Test")
+ enter_text_to_cell(gridwin, "D4", "Test")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ xRows = xDialog.getChild('rows')
+ self.assertEqual('true', get_state_as_dict(xRows)['Checked'])
+
+ xSearchTerm = xDialog.getChild("searchterm")
+
+ xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"Test"}))
+
+ xSearchall = xDialog.getChild("searchall")
+ with self.ui_test.execute_dialog_through_action(
+ xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as xResultsDialog:
+ xResults = xResultsDialog.getChild("results")
+ self.assertEqual(3, len(xResults.getChildren()))
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Sheet1\t$D$1\tTest' != 'Sheet1\t$A$4\tTest'
+ self.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults.getChild('0'))['Text'])
+ self.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults.getChild('1'))['Text'])
+ self.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults.getChild('2'))['Text'])
+
+ xCols = xDialog.getChild('cols')
+ xCols.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_action(
+ xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as xResultsDialog:
+ xResults = xResultsDialog.getChild("results")
+ self.assertEqual(3, len(xResults.getChildren()))
+ self.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults.getChild('0'))['Text'])
+ self.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults.getChild('1'))['Text'])
+ self.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults.getChild('2'))['Text'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: