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 in5b5c52a3a4
"Try make this more robust in slow environments" plusb5dd2b4218
"Also cope with intermittend DisposedExceptions." Change-Id: I4d429a96b7b595776aaf3fa20e3e03b00ca886bc
This commit is contained in:
@@ -38,6 +38,7 @@ import com.sun.star.frame.XController;
|
|||||||
import com.sun.star.frame.XDispatch;
|
import com.sun.star.frame.XDispatch;
|
||||||
import com.sun.star.frame.XDispatchProvider;
|
import com.sun.star.frame.XDispatchProvider;
|
||||||
import com.sun.star.frame.XModel;
|
import com.sun.star.frame.XModel;
|
||||||
|
import com.sun.star.lang.DisposedException;
|
||||||
import com.sun.star.lang.XComponent;
|
import com.sun.star.lang.XComponent;
|
||||||
import com.sun.star.lang.XMultiServiceFactory;
|
import com.sun.star.lang.XMultiServiceFactory;
|
||||||
import com.sun.star.sheet.XSpreadsheet;
|
import com.sun.star.sheet.XSpreadsheet;
|
||||||
@@ -86,7 +87,6 @@ public class AccessibleEditableTextPara_PreviewCell extends TestCase {
|
|||||||
*/
|
*/
|
||||||
protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
|
protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
|
||||||
|
|
||||||
XAccessibleContext oObj = null;
|
|
||||||
XCell xCell = null;
|
XCell xCell = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -136,19 +136,38 @@ public class AccessibleEditableTextPara_PreviewCell extends TestCase {
|
|||||||
throw new StatusException(Status.failed("Couldn't change mode"));
|
throw new StatusException(Status.failed("Couldn't change mode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
shortWait();
|
XAccessibleContext oObj = null;
|
||||||
|
for (int i = 0;; ++i) {
|
||||||
|
try {
|
||||||
XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), xModel);
|
Thread.sleep(500);
|
||||||
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
|
} catch (InterruptedException e) {
|
||||||
//AccessibilityTools.printAccessibleTree(log,xRoot);
|
throw new RuntimeException(e);
|
||||||
AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE_CELL,true);
|
}
|
||||||
|
try {
|
||||||
|
XAccessible xRoot = AccessibilityTools.getAccessibleObject(
|
||||||
|
AccessibilityTools.getCurrentWindow(
|
||||||
|
(XMultiServiceFactory) Param.getMSF(), xModel));
|
||||||
|
if (xRoot != null) {
|
||||||
|
AccessibilityTools.getAccessibleObjectForRole(
|
||||||
|
xRoot, AccessibleRole.TABLE_CELL, true);
|
||||||
xRoot = AccessibilityTools.SearchedAccessible;
|
xRoot = AccessibilityTools.SearchedAccessible;
|
||||||
|
if (xRoot != null) {
|
||||||
//AccessibilityTools.printAccessibleTree(log,xRoot);
|
oObj = AccessibilityTools.getAccessibleObjectForRole(
|
||||||
|
xRoot, AccessibleRole.PARAGRAPH);
|
||||||
oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,AccessibleRole.PARAGRAPH);
|
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 AccessibleRoot.HEADER object");
|
||||||
|
}
|
||||||
|
log.println("No TABLE_CELL/PARAGRAPH found yet, retrying");
|
||||||
|
}
|
||||||
|
|
||||||
log.println("ImplementationName " + utils.getImplName(oObj));
|
log.println("ImplementationName " + utils.getImplName(oObj));
|
||||||
log.println("AccessibleName " + oObj.getAccessibleName());
|
log.println("AccessibleName " + oObj.getAccessibleName());
|
||||||
@@ -169,12 +188,4 @@ public class AccessibleEditableTextPara_PreviewCell extends TestCase {
|
|||||||
|
|
||||||
return tEnv;
|
return tEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void shortWait() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000) ;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
System.out.println("While waiting :" + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user