diff options
author | jlorber <jlorber@linagora.com> | 2025-02-26 10:38:59 +0100 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2025-03-19 01:15:40 +0100 |
commit | 4957d832c76598e78a57324dad5b4de7345a33e2 (patch) | |
tree | 966a64a54dd1a850eb54b0fb2a089758c47d52eb /sw | |
parent | 1c4c24042cbe0ede59513d30a676442f7f238b62 (diff) |
tdf#163616 add Match Diacritics to the find bar
Trying to replicate the behaviour implemented
in the search dialog, while trying to respect
the previous logic for search bar which
ignores diacritics and kashida if CTL font
is enabled.
In my opinion, the new checkbox should be the
only parameter ruling whether the search
should match diacritics or not, but we
can still ignore kashida if CTL font is
enabled.
Change-Id: I1b88be26dd80a1ebbcf78c32ade7d5a289e0766c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182212
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/uitest/findBar/findbar.py | 33 | ||||
-rw-r--r-- | sw/uiconfig/sglobal/toolbar/findbar.xml | 1 | ||||
-rw-r--r-- | sw/uiconfig/sweb/toolbar/findbar.xml | 1 | ||||
-rw-r--r-- | sw/uiconfig/swriter/toolbar/findbar.xml | 1 |
4 files changed, 32 insertions, 4 deletions
diff --git a/sw/qa/uitest/findBar/findbar.py b/sw/qa/uitest/findBar/findbar.py index 577885411c07..f22b99f1964c 100644 --- a/sw/qa/uitest/findBar/findbar.py +++ b/sw/qa/uitest/findBar/findbar.py @@ -28,6 +28,10 @@ class FindBar(UITestCase): xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"})) xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibréOffice Math"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "libreOffice Calc"})) # open the Find Bar xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"})) @@ -38,14 +42,14 @@ class FindBar(UITestCase): # Select the Find Bar xfind_bar = xWriterDoc.getChild("FindBar") - self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14") + self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "15") # Press on FindAll in the Find Bar xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4 self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll") - self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibrélibreLibre") # Press on Find Next in the Find Bar xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos @@ -59,10 +63,31 @@ class FindBar(UITestCase): self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch") - self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "libre") + + # Press on Match Case in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "5"})) # 5 is Match Case pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "6") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Match Case") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:MatchCase") + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) # Press on Find All to see the effect of Match Case + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibréLibre") + + # Press on Match Diacritics in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "6"})) # 6 is Match Diacritics pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "7") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Match Diacritics") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:MatchDiacritics") + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) # Press on Find All to see the effect of Match Diacritics (with Match Case still active) + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") + + # Additional test with word containing diacritic and uppercase, match case and diacritics filters on + xfind.executeAction ("CLEAR", tuple()) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libré"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libré") # Close the Find Bar xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close - # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/uiconfig/sglobal/toolbar/findbar.xml b/sw/uiconfig/sglobal/toolbar/findbar.xml index 15a29ac85162..31a9f96f9718 100644 --- a/sw/uiconfig/sglobal/toolbar/findbar.xml +++ b/sw/uiconfig/sglobal/toolbar/findbar.xml @@ -24,6 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/> <toolbar:toolbaritem xlink:href=".uno:FindAll"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/> + <toolbar:toolbaritem xlink:href=".uno:MatchDiacritics"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbarseparator/> diff --git a/sw/uiconfig/sweb/toolbar/findbar.xml b/sw/uiconfig/sweb/toolbar/findbar.xml index 7c71a1ac2756..95f31f687a78 100644 --- a/sw/uiconfig/sweb/toolbar/findbar.xml +++ b/sw/uiconfig/sweb/toolbar/findbar.xml @@ -24,6 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/> <toolbar:toolbaritem xlink:href=".uno:FindAll"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/> + <toolbar:toolbaritem xlink:href=".uno:MatchDiacritics"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbarseparator/> diff --git a/sw/uiconfig/swriter/toolbar/findbar.xml b/sw/uiconfig/swriter/toolbar/findbar.xml index e77af94f2954..7124dc2e6696 100644 --- a/sw/uiconfig/swriter/toolbar/findbar.xml +++ b/sw/uiconfig/swriter/toolbar/findbar.xml @@ -24,6 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/> <toolbar:toolbaritem xlink:href=".uno:FindAll"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/> + <toolbar:toolbaritem xlink:href=".uno:MatchDiacritics"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbarseparator/> |