summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-16 21:22:46 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-20 09:51:28 +0000
commite3ee6df32e9e1ce93213b16c9e672ed89046b4f6 (patch)
treef980e0f448f8d8ec841e175151979f6b8b268570 /qadevOOo
parent7ff729792483f812e7063f2278b4861e238ccb51 (diff)
qadevOOo: fix race in the ScAccessiblePreviewTable event test
XAccessibleEventBroadcaster::addAccessibleEventListener test calls the fireEvent() and the problem is that the event is triggered not on the print preview itself, but some toolbar button. This then causes an accessible event to be broadcast from the print preview too, but only after doAccessibleAction() returns, some time later from VCL main-loop. If the test checks the flag in the listener before the main thread sends the event, the test fails; try to fix that with XToolkit::processEventsToIdle(). (cherry picked from commit 1d87c2456dab9a0f78ab25d029e82139488e2c57) qadevOOo: sadly XToolkit::processEventsToIdle doesn't fix... ... the ScAccessiblePreviewTable test, somehow the event still doesn't fire in time, let's add an arbitrary sleep too. (cherry picked from commit c94cf0cf5f10edb45a74a58c95c306b0d271645b) Change-Id: Ia52bdf99cdc349ffb0a03536fba271b792caae0f Reviewed-on: https://gerrit.libreoffice.org/20018 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java
index f2e963f36722..bb3e728b698b 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java
@@ -112,7 +112,7 @@ public class ScAccessiblePreviewTable extends TestCase {
* Obtains the accessible object for a table in preview mode.
*/
@Override
- protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected synchronized TestEnvironment createTestEnvironment(final TestParameters Param, final PrintWriter log) {
XCell xCell = null;
@@ -198,7 +198,7 @@ public class ScAccessiblePreviewTable extends TestCase {
XAccessibleContext zoomIn =
AccessibilityTools.getAccessibleObjectForRole(xRoot,AccessibleRole.PUSH_BUTTON, "Zoom In");
- log.println("Getting "+ zoomIn.getAccessibleName());
+ log.println("Getting \"" + zoomIn.getAccessibleName() + "\" which is a \"" + UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, zoomIn).getImplementationName() + "\"");
final XAccessibleAction pressZoom = UnoRuntime.queryInterface(XAccessibleAction.class, zoomIn);
tEnv.addObjRelation("EventProducer",
@@ -206,7 +206,15 @@ public class ScAccessiblePreviewTable extends TestCase {
public void fireEvent() {
try {
pressZoom.doAccessibleAction(0);
- } catch (com.sun.star.lang.IndexOutOfBoundsException ibe) {}
+ // the action is not triggered on the preview table
+ // but some toolbar button - this will indirectly
+ // trigger a table event but only from VCL main loop
+ utils.waitForEventIdle(Param.getMSF());
+ // sadly it turns out that idle is not enough...
+ Thread.sleep(500);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ibe) {
+ log.println("ScAccessiblePreviewTable: IndexOutOfBoundsException from pressZoom.doAccessibleAction(0)");
+ } catch (InterruptedException ex) {}
}
});