summaryrefslogtreecommitdiff
path: root/uitest/uitest
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2017-07-17 23:25:49 +1000
committerMichael Stahl <mstahl@redhat.com>2017-07-20 21:27:04 +0200
commit8b321625d50f33bbd9ae3eed08d5d2b6b1944248 (patch)
treed2500ac96ef5ab2a10c99a82dba9a596db492795 /uitest/uitest
parent102b01c80a271ccaec226d7b0bcc960917ea6b57 (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/uitest')
-rw-r--r--uitest/uitest/test.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index f477369154fa..122df519da4d 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -177,7 +177,23 @@ class UITest(object):
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
- def execute_blocking_action(self, action, dialog_element, args = ()):
+ def execute_blocking_action(self, action, dialog_element=None,
+ args=(), dialog_handler=None):
+ """Executes an action which blocks while a dialog is shown.
+
+ Click a button or perform some other action on the dialog when it
+ is shown.
+
+ Args:
+ action(callable): Will be called to show a dialog, and is expected
+ to block while the dialog is shown.
+ dialog_element(str, optional): The name of a button on the dialog
+ which will be clicked when the dialog is shown.
+ args(tuple, optional): The arguments to be passed to `action`
+ dialog_handler(callable, optional): Will be called when the dialog
+ is shown, with the dialog object passed as a parameter.
+ """
+
thread = threading.Thread(target=action, args=args)
with EventListener(self._xContext, ["DialogExecute", "ModelessDialogExecute"]) as event:
thread.start()
@@ -185,8 +201,11 @@ class UITest(object):
while time_ < MAX_WAIT:
if event.executed:
xDlg = self._xUITest.getTopFocusWindow()
- xUIElement = xDlg.getChild(dialog_element)
- xUIElement.executeAction("CLICK", tuple())
+ if dialog_element:
+ xUIElement = xDlg.getChild(dialog_element)
+ xUIElement.executeAction("CLICK", tuple())
+ if dialog_handler:
+ dialog_handler(xDlg)
thread.join()
return