diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-11-16 21:22:46 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-11-17 10:20:33 +0100 |
commit | 1d87c2456dab9a0f78ab25d029e82139488e2c57 (patch) | |
tree | 977d918df1bc0824b42c016985b78d30209fdbf5 /qadevOOo/tests/java/mod | |
parent | 95af641c81a67103849385b0f8e7b4953efcef0e (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().
Change-Id: Ia52bdf99cdc349ffb0a03536fba271b792caae0f
Diffstat (limited to 'qadevOOo/tests/java/mod')
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java index 1e6b8f0f0891..7844b3ceae94 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java @@ -104,9 +104,8 @@ public class ScAccessiblePreviewTable extends TestCase { * Obtains the accessible object for a table in preview mode. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - - XCell xCell = null; + protected TestEnvironment createTestEnvironment(final TestParameters Param, + final PrintWriter log) throws Exception { log.println("Getting spreadsheet") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; @@ -115,8 +114,7 @@ public class ScAccessiblePreviewTable extends TestCase { new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Getting a cell from sheet") ; - xCell = oSheet.getCellByPosition(0, 0); - + XCell xCell = oSheet.getCellByPosition(0, 0); xCell.setFormula("Value"); XModel xModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); @@ -168,7 +166,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", @@ -176,7 +174,13 @@ 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()); + } catch (com.sun.star.lang.IndexOutOfBoundsException ibe) { + log.println("ScAccessiblePreviewTable: IndexOutOfBoundsException from pressZoom.doAccessibleAction(0)"); + } } }); |