diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-11-04 18:24:25 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-11-04 18:24:25 +0100 |
commit | a25d360b3e08751ea24f1c5ae4dea799d38a668b (patch) | |
tree | 70721edf6014a9d95f0d9a93c8c89f168f6f4279 /qadevOOo | |
parent | e362bc7892e0fd193e541838be4bd26b7ff42fdd (diff) |
Try make this more robust in slow environments
...where the previous .uno:PrintPreview request has not yet been processed, the
same way it had been made more robust for ScAccessiblePageHeader.java in
5b5c52a3a4d048bba8c18dfb06ffca25c670d099 "Try make this more robust in slow
environments" plus b5dd2b4218f966e177d880bcc29fa5fba3bfe1c1 "Also cope with
intermittend DisposedExceptions."
Change-Id: I5244e8f8af9560ae986ed3a836bdf9571574420f
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java index 7b93d2764f9a..9f5b3b0ac233 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java @@ -39,6 +39,7 @@ import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; import com.sun.star.frame.XDispatchProvider; import com.sun.star.frame.XModel; +import com.sun.star.lang.DisposedException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sheet.XSpreadsheet; @@ -113,7 +114,6 @@ public class ScAccessiblePreviewTable extends TestCase { */ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; XCell xCell = null; try { @@ -163,16 +163,34 @@ public class ScAccessiblePreviewTable extends TestCase { throw new StatusException(Status.failed("Couldn't change mode")); } - shortWait(); - - AccessibilityTools at = new AccessibilityTools(); - - XWindow xWindow = AccessibilityTools.getCurrentContainerWindow((XMultiServiceFactory)Param.getMSF(), xModel); - XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - - AccessibilityTools.printAccessibleTree(log,xRoot, Param.getBool(PropertyName.DEBUG_IS_ACTIVE)); - - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE); + XAccessible xRoot; + XInterface oObj; + for (int i = 0;; ++i) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + try { + xRoot = AccessibilityTools.getAccessibleObject( + AccessibilityTools.getCurrentContainerWindow( + (XMultiServiceFactory)Param.getMSF(), xModel)); + if (xRoot != null) { + oObj = AccessibilityTools.getAccessibleObjectForRole( + xRoot, AccessibleRole.TABLE); + if (oObj != null) { + break; + } + } + } catch (DisposedException e) { + log.println("Ignoring DisposedException"); + } + if (i == 20) { // give up after 10 sec + throw new RuntimeException( + "Couldn't get AccessibleRole.TABLE/PUSH_BUTTON object"); + } + log.println("No TABLE/PUSH_BUTTON found yet, retrying"); + } log.println("ImplementationName " + utils.getImplName(oObj)); @@ -195,12 +213,4 @@ public class ScAccessiblePreviewTable extends TestCase { return tEnv; } - - protected void shortWait() { - try { - Thread.sleep(1000) ; - } catch (InterruptedException e) { - System.out.println("While waiting :" + e); - } - } } |