qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit e3ee6df32e9e1ce93213b16c9e672ed89046b4f6 Author: Michael Stahl <mst...@redhat.com> Date: Mon Nov 16 21:22:46 2015 +0100 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 <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java index f2e963f..bb3e728 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) {} } }); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits