diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-12-28 00:03:09 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-12-28 00:19:17 +0100 |
commit | e22a3f596ce50b5166063e217d96ef674a54d380 (patch) | |
tree | 1acc1a07c2261b0bcc27b3d3c2ccfefa51fe4108 /uitest | |
parent | 77e7d43c67c69dcc1cba574c04773b3cca1794b1 (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/writer_tests/spellDialog.py | 6 |
1 files changed, 5 insertions, 1 deletions
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)) |