uitest/writer_tests/spellDialog.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit e22a3f596ce50b5166063e217d96ef674a54d380 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Dec 28 00:03:09 2019 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Dec 28 00:19:17 2019 +0100 UITest: fix spellDialog.SpellingAndGrammarDialog.test_tdf46852 Two problems were present: 1. If local system default locale is not en_US, then in created document, text has some other language initially; and instrted text also gets this language. This may result in no replacement suggestions for the spelling errors, and "changeall" is not active, so expected sequence of changes and clicks does not happen. Fixed by setting language at cursor before paste explicitly. 2. On Windows, the returned text has \r\n paragraph breaks, which didn't match the regex having \n. Fixed by postprocessing the text before match. Change-Id: I320fc62c3c27dfe699fb45669c081df30cb66d6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85877 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/uitest/writer_tests/spellDialog.py b/uitest/writer_tests/spellDialog.py index 9f69fc2c8fe3..e678afea53e9 100644 --- a/uitest/writer_tests/spellDialog.py +++ b/uitest/writer_tests/spellDialog.py @@ -10,6 +10,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict from libreoffice.linguistic.linguservice import get_spellchecker +from com.sun.star.lang import Locale class SpellingAndGrammarDialog(UITestCase): @@ -62,6 +63,8 @@ frog, dogg, catt""" self.ui_test.create_doc_in_start_center("writer") document = self.ui_test.get_component() cursor = document.getCurrentController().getViewCursor() + # Inserted text must be en_US, so make sure to set language in current location + cursor.CharLocale = Locale("en", "US", "") input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break document.Text.insertString(cursor, input_text, False) @@ -94,5 +97,6 @@ frog, dogg, catt""" ) ) - self.assertTrue(re.match(self.TDF46852_REGEX, document.Text.getString())) + output_text = document.Text.getString().replace('\r\n', '\n') + self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits