diff options
author | Luke Deller <luke@deller.id.au> | 2017-07-17 23:25:49 +1000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-07-20 21:27:04 +0200 |
commit | 8b321625d50f33bbd9ae3eed08d5d2b6b1944248 (patch) | |
tree | d2500ac96ef5ab2a10c99a82dba9a596db492795 /uitest/writer_tests | |
parent | 102b01c80a271ccaec226d7b0bcc960917ea6b57 (diff) |
tdf#46852 fix spellcheck continue at beginning
When a spellcheck reaches the end of the document, it is supposed
to be able to continue from the beginning of the document to the
point at which the spellcheck was started.
This was not working in the case where the word at the starting
position was replaced due to a spelling correction, which causes the
starting position to be lost.
Fix this situation by recording the position immediately *before*
the spellcheck starting position, so that it will not be affected
by a spelling correction *at* the starting position.
Change-Id: I9483fd5937dc1e235f6f9639d4856fe15e3d47a6
Reviewed-on: https://gerrit.libreoffice.org/40123
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'uitest/writer_tests')
-rw-r--r-- | uitest/writer_tests/spellDialog.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/uitest/writer_tests/spellDialog.py b/uitest/writer_tests/spellDialog.py new file mode 100644 index 000000000000..9b36ea2a0aa6 --- /dev/null +++ b/uitest/writer_tests/spellDialog.py @@ -0,0 +1,70 @@ +# +# 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 + +class SpellingAndGrammarDialog(UITestCase): + + def launch_dialog(self): + self.ui_test.execute_modeless_dialog_through_command( + ".uno:SpellingAndGrammarDialog") + + return self.xUITest.getTopFocusWindow() + + TDF46852_INPUT = """\ +dogg +dogg +catt dogg +frogg frogg +frogg catt dogg +dogg catt +frog, dogg, catt""" + + TDF46852_CORRECTED = """\ +dog +dog +tact dog +frog frog +frog tact dog +dog tact +frog, dog, tact""" + + def test_tdf46852(self): + # This automates the steps described in the bug report tdf#46852 + + # Step 1: Create a document with repetitious misspelled words + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + cursor = document.getCurrentController().getViewCursor() + input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break + document.Text.insertString(cursor, input_text, False) + + # Step 2: Place cursor on 4th line after second "frogg" + cursor.goUp(2, False) + cursor.goLeft(1, False) + + # Step 3: Initiate spellchecking + spell_dialog = self.launch_dialog() + + # Step 4: Repetitively click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = spell_dialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + changeall.executeAction("CLICK", ()) + # The third time we click on changeall, the click action is going to + # block while two message boxes are shown, so we need to do this third + # click specially: + self.ui_test.execute_blocking_action( + changeall.executeAction, args=('CLICK', ()), + # Step 5: Confirm to "Continue check at beginning of document" + dialog_handler=lambda dialog : + self.ui_test.execute_blocking_action( + dialog.getChild('yes').executeAction, 'ok', ('CLICK', ()) + ) + ) + + self.assertEqual(document.Text.getString(), self.TDF46852_CORRECTED) + |