diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-08-28 13:23:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-28 13:23:58 +0200 |
commit | 5b5c52a3a4d048bba8c18dfb06ffca25c670d099 (patch) | |
tree | f7026d59c3db4a71cd4647aa8ebf5b2c73ef4709 /qadevOOo | |
parent | 09c09fa20b93a236c639a2ce957fc634c8688ce5 (diff) |
Try make this more robust in slow environments
...where the previous .uno:PrintPreview request has not yet been processed and
xRoot/oObj would still be null. Hopefully, it does not introduce infinite
loops, though.
Change-Id: Ie79e0b0a3185528ab4036ed7a33de81117c02c83
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java index fb183120f233..5c595c181f79 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java @@ -90,8 +90,6 @@ public class ScAccessiblePageHeader extends TestCase { protected TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log) { - XInterface oObj = null; - // inserting some content to have non-empty page preview XCell xCell = null; try { @@ -137,20 +135,28 @@ public class ScAccessiblePageHeader extends TestCase { throw new StatusException(Status.failed("Couldn't change mode")); } - try { - Thread.sleep(500); - } catch (InterruptedException ex) {} - AccessibilityTools at = new AccessibilityTools(); - XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel); - XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - - oObj = AccessibilityTools.getAccessibleObjectForRole - (xRoot, AccessibleRole.HEADER, ""); - - log.println("ImplementationName " + utils.getImplName(oObj)); - AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XInterface oObj = null; + for (;;) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + if (xRoot != null) { + oObj = AccessibilityTools.getAccessibleObjectForRole + (xRoot, AccessibleRole.HEADER, ""); + if (oObj != null) { + log.println("ImplementationName " + utils.getImplName(oObj)); + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + break; + } + } + log.println("No HEADER found yet, retrying"); + } TestEnvironment tEnv = new TestEnvironment(oObj); |