summaryrefslogtreecommitdiff
path: root/sw/qa/uitest
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-12-13 11:06:38 +0100
committerLászló Németh <nemeth@numbertext.org>2022-12-13 14:42:54 +0000
commit71dc8a291ecc5bdae541fce41c8895d6b3302082 (patch)
tree46c8e8a3d7bf7c5c3afa9901e97aa8fe5597bf5e /sw/qa/uitest
parentec8fdffec29de7c80da0c2a440e467c35a297119 (diff)
tdf#45949 sw: add spell checking to hyperlinked text
Recognize plain words within hyperlinks and check their spelling. Not only URLs and e-mail addresses, but plain text of hyperlinks were removed from spell checking, which didn't conform to the specification: "URLs are skipped during spell checking Spelling of URLs in document doesn't make sense, because the words are not separated and often they aren't natural words at all. Since we can only decide what we know, we will only except URLs from spelling already recognized/formatted as URLs and if the URL and the text representation are equal." http://specs.openoffice.org/appwide/linguistic/Spellcheckdialog.sxw, see also https://bz.apache.org/ooo/show_bug.cgi?id=40133. Follow-up to commit ec8fdffec29de7c80da0c2a440e467c35a297119 "tdf#152492 sw: fix unwanted spell checking of parts of URLs" and commit 2cca160f8bfc4597cf0ad3aaaf0017a5210ea0ec "tdf#126657, tdf#145104: Don’t set language to none on defined styles". Change-Id: If2698c54bcdee0de635abd324173c909d9161a02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144044 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index d4b19132c90c..183a85843ab9 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -169,4 +169,40 @@ frog, dogg, catt"""
# This was "Baaed HTTP://www.baaad.org baaad baaad" (spelling URLs)
self.assertEqual("Baaed http://www.baaad.org baaed baaad", output_text)
+ def test_tdf45949(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no dictionary support for en_US available")
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ cursor = document.getCurrentController().getViewCursor()
+ # Inserted text must be en_US, so make sure to set language in current location
+ cursor.CharLocale = Locale("en", "US", "")
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xEdit = xMainWindow.getChild("writer_edit")
+
+ # URL is recognized during typing
+ type_text(xEdit, "baaad http://www.baaad.org baaad")
+
+ # add spaces before and after the word "baaad" within the URL
+ cursor.goLeft(10, False)
+ type_text(xEdit, " ")
+ cursor.goLeft(6, False)
+ type_text(xEdit, " ")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog:
+ checkgrammar = xDialog.getChild('checkgrammar')
+ if get_state_as_dict(checkgrammar)['Selected'] == 'true':
+ checkgrammar.executeAction('CLICK', ())
+ self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
+
+ change = xDialog.getChild('change')
+ change.executeAction("CLICK", ())
+ change.executeAction("CLICK", ())
+
+ output_text = document.Text.getString()
+ # This was "Baaed HTTP://www. baaad .org baaed" (skipped non-URL words of hypertext)
+ self.assertEqual("Baaed http://www. baaed .org baaad", output_text)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: