Kaydet (Commit) 3bdf45cf authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS qadev11 (1.7.16); FILE MERGED

2003/09/03 14:57:58 sw 1.7.16.1: #112049#
üst 7d70a27d
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: _XAccessibleAction.java,v $ * $RCSfile: _XAccessibleAction.java,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change:$Date: 2003-05-22 13:29:36 $ * last change:$Date: 2003-09-08 10:04:36 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -61,19 +61,10 @@ ...@@ -61,19 +61,10 @@
package ifc.accessibility; package ifc.accessibility;
import lib.MultiMethodTest;
import com.sun.star.accessibility.XAccessibleAction; import com.sun.star.accessibility.XAccessibleAction;
public class _XAccessibleAction extends lib.MultiMethodTest { public class _XAccessibleAction extends lib.MultiMethodTest {
private static final String className =
"com.sun.star.accessibility.XAccessibleAction";
// temporary while accessibility package is in com.sun.star
protected String getTestedClassName() {
return className;
}
public XAccessibleAction oObj = null; public XAccessibleAction oObj = null;
public int count = 0; public int count = 0;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: _XAccessibleComponent.java,v $ * $RCSfile: _XAccessibleComponent.java,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change:$Date: 2003-05-22 13:29:47 $ * last change:$Date: 2003-09-08 10:04:48 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -58,18 +58,20 @@ ...@@ -58,18 +58,20 @@
* *
* *
************************************************************************/ ************************************************************************/
package ifc.accessibility; package ifc.accessibility;
import java.util.Vector;
import lib.MultiMethodTest;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.Point; import com.sun.star.awt.Point;
import com.sun.star.awt.Rectangle; import com.sun.star.awt.Rectangle;
import com.sun.star.awt.Size; import com.sun.star.awt.Size;
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.UnoRuntime;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import java.util.Vector;
import lib.MultiMethodTest;
/** /**
* Testing <code>com.sun.star.accessibility.XAccessibleComponent</code> * Testing <code>com.sun.star.accessibility.XAccessibleComponent</code>
...@@ -82,6 +84,7 @@ import lib.MultiMethodTest; ...@@ -82,6 +84,7 @@ import lib.MultiMethodTest;
* <li><code> getLocationOnScreen()</code></li> * <li><code> getLocationOnScreen()</code></li>
* <li><code> getSize()</code></li> * <li><code> getSize()</code></li>
* <li><code> grabFocus()</code></li> * <li><code> grabFocus()</code></li>
* <li><code> getAccessibleKeyBinding()</code></li>
* </ul> <p> * </ul> <p>
* *
* @see com.sun.star.accessibility.XAccessibleComponent * @see com.sun.star.accessibility.XAccessibleComponent
...@@ -89,20 +92,9 @@ import lib.MultiMethodTest; ...@@ -89,20 +92,9 @@ import lib.MultiMethodTest;
public class _XAccessibleComponent extends MultiMethodTest { public class _XAccessibleComponent extends MultiMethodTest {
public XAccessibleComponent oObj = null; public XAccessibleComponent oObj = null;
private Rectangle bounds = null;
private Vector KnownBounds = new Vector();
private Rectangle bounds = null ;
private Vector KnownBounds = new Vector() ;
private static final String className =
"com.sun.star.accessibility.XAccessibleComponent" ;
/**
* Walkaround for current interface naming ('drafts' prefix)
* @return The class name to load
*/
protected String getTestedClassName() {
return className;
}
/** /**
* First checks 4 inner bounds (upper, lower, left and right) * First checks 4 inner bounds (upper, lower, left and right)
...@@ -121,101 +113,126 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -121,101 +113,126 @@ public class _XAccessibleComponent extends MultiMethodTest {
public void _containsPoint() { public void _containsPoint() {
requiredMethod("getBounds()"); requiredMethod("getBounds()");
boolean result = true ; boolean result = true;
int curX = 0; int curX = 0;
//while (!oObj.containsPoint(new Point(curX, bounds.Y)) && curX < bounds.Width+bounds.X) { //while (!oObj.containsPoint(new Point(curX, bounds.Y)) && curX < bounds.Width+bounds.X) {
while (!oObj.containsPoint(new Point(curX, 0)) && curX < bounds.Width) { while (!oObj.containsPoint(new Point(curX, 0)) &&
(curX < bounds.Width)) {
curX++; curX++;
}; }
;
//if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) { //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
if (curX < bounds.Width) { if (curX < bounds.Width) {
log.println("Upper bound of box containsPoint point (" log.println("Upper bound of box containsPoint point (" + curX +
+ curX + ",0) - OK"); ",0) - OK");
} else { } else {
log.println log.println(
("Upper bound of box containsPoint no component points - FAILED"); "Upper bound of box containsPoint no component points - FAILED");
result = false; result = false;
} }
curX = 0; curX = 0;
//while (!oObj.containsPoint(new Point(curX, bounds.Y+bounds.Height - 1))
while (!oObj.containsPoint(new Point(curX, bounds.Height - 1))
&& curX < bounds.Width) {
log.println("containsPoint returns false for ("+curX+","+bounds.Height+")"); //while (!oObj.containsPoint(new Point(curX, bounds.Y+bounds.Height - 1))
while (!oObj.containsPoint(new Point(curX, bounds.Height - 1)) &&
(curX < bounds.Width)) {
log.println("containsPoint returns false for (" + curX + "," +
bounds.Height + ")");
curX++; curX++;
}; }
;
//if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) { //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
if (curX < bounds.Width) { if (curX < bounds.Width) {
log.println("Lower bound of box containsPoint point (" log.println("Lower bound of box containsPoint point (" + curX +
+ curX + "," + (bounds.Height - 1) + ") - OK"); "," + (bounds.Height - 1) + ") - OK");
} else { } else {
log.println log.println(
("Lower bound of box containsPoint no component points - FAILED"); "Lower bound of box containsPoint no component points - FAILED");
result = false; result = false;
} }
int curY = 0; int curY = 0;
//while (!oObj.containsPoint(new Point(bounds.X, curY)) && curY < bounds.Height+bounds.Y) { //while (!oObj.containsPoint(new Point(bounds.X, curY)) && curY < bounds.Height+bounds.Y) {
while (!oObj.containsPoint(new Point(0, curY)) && curY < bounds.Height) { while (!oObj.containsPoint(new Point(0, curY)) &&
(curY < bounds.Height)) {
curY++; curY++;
}; }
;
//if ((bounds.Y <= curY) && (curY < bounds.Height+bounds.Y)) { //if ((bounds.Y <= curY) && (curY < bounds.Height+bounds.Y)) {
if (curY < bounds.Height) { if (curY < bounds.Height) {
log.println("Left bound of box containsPoint point (0," log.println("Left bound of box containsPoint point (0," + curY +
+ curY + ") - OK"); ") - OK");
} else { } else {
log.println log.println(
("Left bound of box containsPoint no component points - FAILED"); "Left bound of box containsPoint no component points - FAILED");
result = false; result = false;
} }
curY = 0; curY = 0;
//while (!oObj.containsPoint(new Point(bounds.X+bounds.Width - 1, curY)) //while (!oObj.containsPoint(new Point(bounds.X+bounds.Width - 1, curY))
// && curY < bounds.Height+bounds.Y) { // && curY < bounds.Height+bounds.Y) {
while (!oObj.containsPoint(new Point(bounds.Width - 1, curY)) && curY < bounds.Height) { while (!oObj.containsPoint(new Point(bounds.Width - 1, curY)) &&
(curY < bounds.Height)) {
curY++; curY++;
}; }
;
//if ((bounds.Y <= curY) && (curY < bounds.Height + bounds.Y)) { //if ((bounds.Y <= curY) && (curY < bounds.Height + bounds.Y)) {
if (curY < bounds.Height) { if (curY < bounds.Height) {
log.println("Right bound of box containsPoint point (" log.println("Right bound of box containsPoint point (" +
+ (bounds.Width - 1) + "," + curY + ") - OK"); (bounds.Width - 1) + "," + curY + ") - OK");
} else { } else {
log.println log.println(
("Right bound of box containsPoint no component points - FAILED"); "Right bound of box containsPoint no component points - FAILED");
result = false; result = false;
} }
boolean locRes = true; boolean locRes = true;
for (int x = -1; x <= bounds.Width; x++) { for (int x = -1; x <= bounds.Width; x++) {
locRes &= !oObj.containsPoint(new Point(x, -1)); locRes &= !oObj.containsPoint(new Point(x, -1));
locRes &= !oObj.containsPoint(new Point(x, bounds.Height+bounds.Y)); locRes &= !oObj.containsPoint(
new Point(x, bounds.Height + bounds.Y));
} }
if (locRes) { if (locRes) {
log.println("Outer upper and lower bounds contain no component " log.println("Outer upper and lower bounds contain no component " +
+ "points - OK"); "points - OK");
} else { } else {
log.println("Outer upper and lower bounds CONTAIN some component " log.println("Outer upper and lower bounds CONTAIN some component " +
+ "points - FAILED"); "points - FAILED");
result = false; result = false;
} }
locRes = true; locRes = true;
for (int y = -1; y <= bounds.Height; y++) { for (int y = -1; y <= bounds.Height; y++) {
locRes &= !oObj.containsPoint(new Point(-1, y)); locRes &= !oObj.containsPoint(new Point(-1, y));
locRes &= !oObj.containsPoint(new Point(bounds.X+bounds.Width, y)); locRes &= !oObj.containsPoint(
new Point(bounds.X + bounds.Width, y));
} }
if (locRes) { if (locRes) {
log.println("Outer left and right bounds contain no component " log.println("Outer left and right bounds contain no component " +
+ "points - OK"); "points - OK");
} else { } else {
log.println("Outer left and right bounds CONTAIN some component " log.println("Outer left and right bounds CONTAIN some component " +
+ "points - FAILED"); "points - FAILED");
result = false; result = false;
} }
tRes.tested("containsPoint()", result) ; tRes.tested("containsPoint()", result);
} }
/** /**
...@@ -231,132 +248,171 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -231,132 +248,171 @@ public class _XAccessibleComponent extends MultiMethodTest {
* another child is returned. * another child is returned.
*/ */
public void _getAccessibleAtPoint() { public void _getAccessibleAtPoint() {
boolean result = true;
boolean result = true ;
XAccessibleComponent[] children = getChildrenComponents(); XAccessibleComponent[] children = getChildrenComponents();
if (children.length > 0) { if (children.length > 0) {
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {
Rectangle chBnd = children[i].getBounds(); Rectangle chBnd = children[i].getBounds();
if (chBnd.X == -1) continue;
log.println("Checking child with bounds " +
"(" + chBnd.X + "," + chBnd.Y + "),("
+ chBnd.Width + "," + chBnd.Height + "): "
+ util.AccessibilityTools.accessibleToString(children[i]));
XAccessibleContext xAc = (XAccessibleContext) if (chBnd.X == -1) {
UnoRuntime.queryInterface(XAccessibleContext.class, children[i]) ; continue;
}
log.println("Checking child with bounds " + "(" + chBnd.X +
"," + chBnd.Y + "),(" + chBnd.Width + "," +
chBnd.Height + "): " +
util.AccessibilityTools.accessibleToString(
children[i]));
XAccessibleContext xAc = (XAccessibleContext) UnoRuntime.queryInterface(
XAccessibleContext.class,
children[i]);
boolean isShowing = xAc.getAccessibleStateSet().contains( boolean isShowing = xAc.getAccessibleStateSet()
com.sun.star.accessibility.AccessibleStateType.SHOWING); .contains(com.sun.star.accessibility.AccessibleStateType.SHOWING);
log.println("\tStateType containsPoint SHOWING: "+isShowing); log.println("\tStateType containsPoint SHOWING: " +
isShowing);
if (!isShowing) { if (!isShowing) {
log.println("Child is invisible - OK"); log.println("Child is invisible - OK");
continue; continue;
} }
String pos = "(" + chBnd.X + "," + chBnd.Y + ")"; String pos = "(" + chBnd.X + "," + chBnd.Y + ")";
if (KnownBounds.contains(pos) && isShowing) { if (KnownBounds.contains(pos) && isShowing) {
log.println("Child is covered by another and can't be reached"); log.println(
"Child is covered by another and can't be reached");
continue; continue;
} }
KnownBounds.add(pos); KnownBounds.add(pos);
log.println("finding the point which lies on the component"); log.println("finding the point which lies on the component");
int curX = chBnd.Width; int curX = chBnd.Width;
int curY = chBnd.Height/2; int curY = chBnd.Height / 2;
while (!children[i].containsPoint(new Point(curX, curY))
&& curX > 0 && curY > 0) { while (!children[i].containsPoint(new Point(curX, curY)) &&
(curX > 0) && (curY > 0)) {
curX--; curX--;
curY--; curY--;
}; }
if (curX==chBnd.Width && isShowing) { ;
if ((curX == chBnd.Width) && isShowing) {
log.println("Couldn't find a point with containsPoint"); log.println("Couldn't find a point with containsPoint");
continue; continue;
} }
// trying the point laying on child // trying the point laying on child
XAccessible xAcc = oObj.getAccessibleAtPoint XAccessible xAcc = oObj.getAccessibleAtPoint(
(new Point(chBnd.X +curX, chBnd.Y+curY)); new Point(chBnd.X + curX,
chBnd.Y + curY));
if (xAcc == null) { if (xAcc == null) {
log.println("The child not found at point (" log.println("The child not found at point (" +
+ (chBnd.X +curX ) + "," + (chBnd.Y+curY) + ") - FAILED"); (chBnd.X + curX) + "," + (chBnd.Y + curY) +
if (!isShowing) { ") - FAILED");
if (isShowing) {
result = false; result = false;
} else result = true; } else {
result &= true;
}
} else { } else {
XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface(
(XAccessible.class, children[i]); XAccessible.class,
XAccessibleContext xAccC = (XAccessibleContext) UnoRuntime.queryInterface children[i]);
(XAccessibleContext.class, children[i]); XAccessibleContext xAccC = (XAccessibleContext) UnoRuntime.queryInterface(
log.println("Child found at point (" XAccessibleContext.class,
+ (chBnd.X +curX) + "," + (chBnd.Y+curY) + ") - OK"); children[i]);
log.println("Child found at point (" + (chBnd.X + curX) +
"," + (chBnd.Y + curY) + ") - OK");
boolean res = false; boolean res = false;
int expIndex; int expIndex;
String expName; String expName;
String expDesc; String expDesc;
if (xAccCh != null) { if (xAccCh != null) {
res = util.AccessibilityTools.equals(xAccCh, xAcc); res = util.AccessibilityTools.equals(xAccCh, xAcc);
expIndex = xAccCh.getAccessibleContext().getAccessibleIndexInParent(); expIndex = xAccCh.getAccessibleContext()
expName = xAccCh.getAccessibleContext().getAccessibleName(); .getAccessibleIndexInParent();
expDesc = xAccCh.getAccessibleContext().getAccessibleDescription(); expName = xAccCh.getAccessibleContext()
.getAccessibleName();
expDesc = xAccCh.getAccessibleContext()
.getAccessibleDescription();
} else { } else {
res = xAccC.getAccessibleName().equals( res = xAccC.getAccessibleName()
xAcc.getAccessibleContext().getAccessibleName()); .equals(xAcc.getAccessibleContext()
.getAccessibleName());
expIndex = xAccC.getAccessibleIndexInParent(); expIndex = xAccC.getAccessibleIndexInParent();
expName = xAccC.getAccessibleName(); expName = xAccC.getAccessibleName();
expDesc = xAccC.getAccessibleDescription(); expDesc = xAccC.getAccessibleDescription();
} }
if (!res) { if (!res) {
int gotIndex = xAcc.getAccessibleContext().getAccessibleIndexInParent(); int gotIndex = xAcc.getAccessibleContext()
.getAccessibleIndexInParent();
if (expIndex < gotIndex) { if (expIndex < gotIndex) {
log.println("The children found is not the same"); log.println("The children found is not the same");
log.println("The expected child " + log.println("The expected child " + expName);
expName);
log.print("is hidden behind the found Child "); log.print("is hidden behind the found Child ");
log.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK"); log.println(xAcc.getAccessibleContext()
.getAccessibleName() + " - OK");
} else { } else {
log.println("The children found is not the same - FAILED"); log.println(
log.println("Expected: " "The children found is not the same - FAILED");
+expName); log.println("Expected: " + expName);
log.println("Description: " + expDesc);
log.println("Found: " +
xAcc.getAccessibleContext()
.getAccessibleName());
log.println("Description: " + log.println("Description: " +
expDesc); xAcc.getAccessibleContext()
log.println("Found: " .getAccessibleDescription());
+xAcc.getAccessibleContext().getAccessibleName()); result = false;
log.println("Description: " +
xAcc.getAccessibleContext().getAccessibleDescription());
result = false ;
} }
} }
} }
// trying the point NOT laying on child // trying the point NOT laying on child
xAcc = oObj.getAccessibleAtPoint xAcc = oObj.getAccessibleAtPoint(
(new Point(chBnd.X - 1, chBnd.Y - 1)); new Point(chBnd.X - 1, chBnd.Y - 1));
if (xAcc == null) { if (xAcc == null) {
log.println("No children found at point (" log.println("No children found at point (" +
+ (chBnd.X - 1) + "," + (chBnd.Y - 1) + ") - OK"); (chBnd.X - 1) + "," + (chBnd.Y - 1) +
") - OK");
result &= true; result &= true;
} else { } else {
XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface(
(XAccessible.class, children[i]); XAccessible.class,
children[i]);
boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
if (res) { if (res) {
log.println("The same child found outside " log.println("The same child found outside " +
+ "its bounds at ("+(chBnd.X - 1) +","+ (chBnd.Y - 1)+") - FAILED"); "its bounds at (" + (chBnd.X - 1) + "," +
result = false ; (chBnd.Y - 1) + ") - FAILED");
result = false;
} }
} }
} }
} else { } else {
log.println("There are no children supporting " log.println("There are no children supporting " +
+ "XAccessibleComponent"); "XAccessibleComponent");
} }
tRes.tested("getAccessibleAtPoint()", result) ; tRes.tested("getAccessibleAtPoint()", result);
} }
/** /**
...@@ -366,18 +422,17 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -366,18 +422,17 @@ public class _XAccessibleComponent extends MultiMethodTest {
* and size (Width, Height) is greater than 0. * and size (Width, Height) is greater than 0.
*/ */
public void _getBounds() { public void _getBounds() {
boolean result = true ; boolean result = true;
bounds = oObj.getBounds() ; bounds = oObj.getBounds();
result &= bounds != null result &= ((bounds != null) && (bounds.X >= 0) && (bounds.Y >= 0) && (bounds.Width > 0) && (bounds.Height > 0));
&& bounds.X >=0 && bounds.Y >=0
&& bounds.Width >0 && bounds.Height >0;
log.println("Bounds = " + (bounds != null log.println("Bounds = " +
? "(" + bounds.X + "," + bounds.Y + "),(" ((bounds != null)
+ bounds.Width + "," + bounds.Height + ")" : "null")); ? ("(" + bounds.X + "," + bounds.Y + "),(" +
bounds.Width + "," + bounds.Height + ")") : "null"));
tRes.tested("getBounds()", result) ; tRes.tested("getBounds()", result);
} }
/** /**
...@@ -394,12 +449,12 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -394,12 +449,12 @@ public class _XAccessibleComponent extends MultiMethodTest {
public void _getLocation() { public void _getLocation() {
requiredMethod("getBounds()"); requiredMethod("getBounds()");
boolean result = true ; boolean result = true;
Point loc = oObj.getLocation() ; Point loc = oObj.getLocation();
result &= loc.X == bounds.X && loc.Y == bounds.Y ; result &= ((loc.X == bounds.X) && (loc.Y == bounds.Y));
tRes.tested("getLocation()", result) ; tRes.tested("getLocation()", result);
} }
/** /**
...@@ -421,20 +476,20 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -421,20 +476,20 @@ public class _XAccessibleComponent extends MultiMethodTest {
XAccessibleComponent parent = getParentComponent(); XAccessibleComponent parent = getParentComponent();
boolean result = true ; boolean result = true;
Point loc = oObj.getLocationOnScreen(); Point loc = oObj.getLocationOnScreen();
log.println("Location is (" + loc.X + "," + loc.Y + ")"); log.println("Location is (" + loc.X + "," + loc.Y + ")");
if (parent != null) { if (parent != null) {
Point parLoc = parent.getLocationOnScreen(); Point parLoc = parent.getLocationOnScreen();
log.println("Parent location is (" log.println("Parent location is (" + parLoc.X + "," + parLoc.Y +
+ parLoc.X + "," + parLoc.Y + ")"); ")");
result &= parLoc.X + bounds.X == loc.X; result &= ((parLoc.X + bounds.X) == loc.X);
result &= parLoc.Y + bounds.Y == loc.Y; result &= ((parLoc.Y + bounds.Y) == loc.Y);
} }
tRes.tested("getLocationOnScreen()", result) ; tRes.tested("getLocationOnScreen()", result);
} }
/** /**
...@@ -450,13 +505,13 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -450,13 +505,13 @@ public class _XAccessibleComponent extends MultiMethodTest {
public void _getSize() { public void _getSize() {
requiredMethod("getBounds()"); requiredMethod("getBounds()");
boolean result = true ; boolean result = true;
Size size = oObj.getSize() ; Size size = oObj.getSize();
result &= size.Width == bounds.Width; result &= (size.Width == bounds.Width);
result &= size.Height == bounds.Height; result &= (size.Height == bounds.Height);
tRes.tested("getSize()", result) ; tRes.tested("getSize()", result);
} }
/** /**
...@@ -465,11 +520,10 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -465,11 +520,10 @@ public class _XAccessibleComponent extends MultiMethodTest {
* Has <b> OK </b> status if no runtime exceptions occured. * Has <b> OK </b> status if no runtime exceptions occured.
*/ */
public void _grabFocus() { public void _grabFocus() {
boolean result = true;
oObj.grabFocus();
boolean result = true ; tRes.tested("grabFocus()", result);
oObj.grabFocus() ;
tRes.tested("grabFocus()", result) ;
} }
/** /**
...@@ -480,34 +534,42 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -480,34 +534,42 @@ public class _XAccessibleComponent extends MultiMethodTest {
* such children were not found or some error occured. * such children were not found or some error occured.
*/ */
private XAccessibleComponent[] getChildrenComponents() { private XAccessibleComponent[] getChildrenComponents() {
XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface(
(XAccessible.class, oObj) ; XAccessible.class, oObj);
if (xAcc == null) { if (xAcc == null) {
log.println("Component doesn't support XAccessible."); log.println("Component doesn't support XAccessible.");
return new XAccessibleComponent[0]; return new XAccessibleComponent[0];
} }
XAccessibleContext xAccCon = xAcc.getAccessibleContext(); XAccessibleContext xAccCon = xAcc.getAccessibleContext();
int cnt = xAccCon.getAccessibleChildCount(); int cnt = xAccCon.getAccessibleChildCount();
// for cases when too many children exist checking only first 50 // for cases when too many children exist checking only first 50
if (cnt > 50) cnt = 50 ; if (cnt > 50) {
cnt = 50;
}
Vector childComp = new Vector(); Vector childComp = new Vector();
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
try { try {
XAccessible child = xAccCon.getAccessibleChild(i); XAccessible child = xAccCon.getAccessibleChild(i);
XAccessibleContext xAccConCh = child.getAccessibleContext(); XAccessibleContext xAccConCh = child.getAccessibleContext();
XAccessibleComponent xChAccComp = (XAccessibleComponent) XAccessibleComponent xChAccComp = (XAccessibleComponent) UnoRuntime.queryInterface(
UnoRuntime.queryInterface(XAccessibleComponent.class, XAccessibleComponent.class,
xAccConCh); xAccConCh);
if (xChAccComp != null) { if (xChAccComp != null) {
childComp.add(xChAccComp) ; childComp.add(xChAccComp);
} }
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {} } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
}
} }
return (XAccessibleComponent[]) childComp.toArray return (XAccessibleComponent[]) childComp.toArray(
(new XAccessibleComponent[childComp.size()]); new XAccessibleComponent[childComp.size()]);
} }
/** /**
...@@ -518,10 +580,12 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -518,10 +580,12 @@ public class _XAccessibleComponent extends MultiMethodTest {
* has no parent or some errors occured. * has no parent or some errors occured.
*/ */
private XAccessibleComponent getParentComponent() { private XAccessibleComponent getParentComponent() {
XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface(
(XAccessible.class, oObj) ; XAccessible.class, oObj);
if (xAcc == null) { if (xAcc == null) {
log.println("Component doesn't support XAccessible."); log.println("Component doesn't support XAccessible.");
return null; return null;
} }
...@@ -530,14 +594,19 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -530,14 +594,19 @@ public class _XAccessibleComponent extends MultiMethodTest {
if (xAccPar == null) { if (xAccPar == null) {
log.println("Component has no accessible parent."); log.println("Component has no accessible parent.");
return null; return null;
} }
XAccessibleContext xAccConPar = xAccPar.getAccessibleContext(); XAccessibleContext xAccConPar = xAccPar.getAccessibleContext();
XAccessibleComponent parent = (XAccessibleComponent) XAccessibleComponent parent = (XAccessibleComponent) UnoRuntime.queryInterface(
UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar); XAccessibleComponent.class,
xAccConPar);
if (parent == null) { if (parent == null) {
log.println log.println(
("Accessible parent doesn't support XAccessibleComponent"); "Accessible parent doesn't support XAccessibleComponent");
return null; return null;
} }
...@@ -562,4 +631,12 @@ public class _XAccessibleComponent extends MultiMethodTest { ...@@ -562,4 +631,12 @@ public class _XAccessibleComponent extends MultiMethodTest {
tRes.tested("getBackground()", true); tRes.tested("getBackground()", true);
} }
} /**
* Restores initial component text.
*/
protected void after() {
if (tEnv.getObjRelation("Destroy") != null) {
disposeEnvironment();
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment