log.println("finding the point which lies on the component");
int curX = chBnd.Width / 2;
int curY = chBnd.Height / 2;
while (!children[i].containsPoint(new Point(curX, curY)) &&
(curX > 0) && (curY > 0)) {
curX--;
curY--;
}
;
if ((curX == chBnd.Width) && isShowing) {
log.println("Couldn't find a point with containsPoint");
continue;
}
// trying the point laying on child
XAccessible xAcc = oObj.getAccessibleAtPoint(
new Point(chBnd.X + curX,
chBnd.Y + curY));
Point p = new Point(chBnd.X + curX,chBnd.X + curX);
if (isCovered(p) && isShowing) {
log.println(
"Child might be covered by another and can't be reached");
MightBeCovered = true;
}
KnownBounds.add(chBnd);
if (xAcc == null) {
log.println("The child not found at point (" +
(chBnd.X + curX) + "," + (chBnd.Y + curY) +
") - FAILED");
if (isShowing) {
result = false;
} else {
result &= true;
}
} else {
XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface(
XAccessible.class,
children[i]);
XAccessibleContext xAccC = (XAccessibleContext) UnoRuntime.queryInterface(
XAccessibleContext.class,
children[i]);
log.println("Child found at point (" + (chBnd.X + curX) +
"," + (chBnd.Y + curY) + ") - OK");
boolean res = false;
int expIndex;
String expName;
String expDesc;
if (xAccCh != null) {
res = util.AccessibilityTools.equals(xAccCh, xAcc);
expIndex = xAccCh.getAccessibleContext()
.getAccessibleIndexInParent();
expName = xAccCh.getAccessibleContext()
.getAccessibleName();
expDesc = xAccCh.getAccessibleContext()
.getAccessibleDescription();
} else {
res = xAccC.getAccessibleName()
.equals(xAcc.getAccessibleContext()
.getAccessibleName());
expIndex = xAccC.getAccessibleIndexInParent();
expName = xAccC.getAccessibleName();
expDesc = xAccC.getAccessibleDescription();
}
if (!res) {
int gotIndex = xAcc.getAccessibleContext()
.getAccessibleIndexInParent();
if (expIndex < gotIndex) {
log.println("The children found is not the same");
log.println("The expected child " + expName);
log.print("is hidden behind the found Child ");
log.println(xAcc.getAccessibleContext()
.getAccessibleName() + " - OK");
} else {
log.println(
"The children found is not the same");
log.println("Expected: " + expName);
log.println("Description: " + expDesc);
log.println("Found: " +
xAcc.getAccessibleContext()
.getAccessibleName());
log.println("Description: " +
xAcc.getAccessibleContext()
.getAccessibleDescription());
if (MightBeCovered) {
log.println("... Child is covered by another - OK");
} else {
log.println("... FAILED");
result = false;
}
}
}
}
// trying the point NOT laying on child
xAcc = oObj.getAccessibleAtPoint(
new Point(chBnd.X - 1, chBnd.Y - 1));
if (xAcc == null) {
log.println("No children found at point (" +
(chBnd.X - 1) + "," + (chBnd.Y - 1) +
") - OK");