summaryrefslogtreecommitdiff
path: root/toolkit/qa/complex/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/qa/complex/toolkit')
-rw-r--r--toolkit/qa/complex/toolkit/CallbackClass.java67
-rwxr-xr-xtoolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java331
-rwxr-xr-xtoolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java385
-rw-r--r--toolkit/qa/complex/toolkit/CheckAsyncCallback.java127
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java489
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java261
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java211
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java99
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java1017
-rw-r--r--toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java88
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/makefile.mk57
-rwxr-xr-xtoolkit/qa/complex/toolkit/makefile.mk82
12 files changed, 3214 insertions, 0 deletions
diff --git a/toolkit/qa/complex/toolkit/CallbackClass.java b/toolkit/qa/complex/toolkit/CallbackClass.java
new file mode 100644
index 000000000000..efc0ef91f7c0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CallbackClass.java
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import com.sun.star.awt.XCallback;
+import lib.MultiMethodTest;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.awt.XRequestCallback</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addCallback()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.awt.XRequestCallback
+ */
+public class CallbackClass implements XCallback{
+
+ private LogWriter log;
+
+ private XMultiServiceFactory xMSF;
+
+
+ public CallbackClass(LogWriter log, XMultiServiceFactory xMSF ) {
+
+ this.xMSF = xMSF;
+ this.log = log;
+ }
+
+
+ /**
+ * Callback method which will be called by the asynchronous
+ * service where we have added our request before.
+ */
+ public void notify( Object aData ) {
+
+ log.println("callback called successfully" );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java
new file mode 100755
index 000000000000..fee95f2e6de0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import complex.toolkit.interface_tests._XAccessibleComponent;
+import complex.toolkit.interface_tests._XAccessibleContext;
+import complex.toolkit.interface_tests._XAccessibleExtendedComponent;
+import complex.toolkit.interface_tests._XAccessibleEventBroadcaster;
+import com.sun.star.awt.XWindow;
+import com.sun.star.chart.XChartDocument;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XExtendedToolkit;
+import java.io.PrintWriter;
+
+/**
+ *
+ */
+public class CheckAccessibleStatusBar extends ComplexTestCase {
+
+ XInterface testObject = null;
+ XMultiServiceFactory xMSF = null;
+ XWindow xWindow = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc",
+// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
+ }
+
+/* public String getTestObjectName() {
+ return "com.sun.star.awt.AccessibleStatusBar";
+ }
+*/
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ public void checkDocs() {
+ Object doc = param.get("DocType");
+ String testDocType;
+ if (doc == null)
+ testDocType = "all";
+ else
+ testDocType = (String)doc;
+
+ System.out.println("Param was " + doc);
+ System.out.println("DocType " + testDocType);
+ if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
+ checkWriterDoc();
+ if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
+ checkMathDoc();
+ if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
+ checkDrawDoc();
+ if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
+ checkImpressDoc();
+ if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
+ checkCalcDoc();
+
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ public void checkWriterDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ log.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ log.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ log.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ log.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ log.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc);
+
+ shortWait();
+ xWindow = (XWindow)UnoRuntime.queryInterface(
+ XWindow.class,tk.getActiveTopWindow());
+
+ shortWait();
+ AccessibilityTools at = new AccessibilityTools();
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ log.println("Get the accessible status bar.");
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ log.println("...OK.");
+
+ XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class,parentContext);
+ String[] services = xSI.getSupportedServiceNames();
+ log.println("*****");
+ log.println("* Implementation Name: " + xSI.getImplementationName());
+ for (int i=0; i<services.length; i++)
+ log.println("* ServiceName "+i+": "+ services[i]);
+ log.println("*****");
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ log.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(testObject, log);
+ assure("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds());
+ assure("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint());
+ assure("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint());
+ assure("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground());
+ assure("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground());
+ assure("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation());
+ assure("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen());
+ assure("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize());
+ assure("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus());
+
+ log.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(testObject, log);
+ assure("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount());
+ assure("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild());
+ assure("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription());
+ assure("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName());
+ assure("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent());
+ assure("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent());
+ assure("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet());
+ assure("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole());
+ assure("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet());
+ assure("failed: XAccessibleContext::getLocale", _xAccContext._getLocale());
+
+ log.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(testObject, log);
+ assure("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont());
+ assure("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText());
+ assure("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText());
+
+ log.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(testObject, log, "Pfff", xWindow);
+ assure("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
+ assure("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java
new file mode 100755
index 000000000000..36394732ce78
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import complex.toolkit.interface_tests._XAccessibleComponent;
+import complex.toolkit.interface_tests._XAccessibleContext;
+import complex.toolkit.interface_tests._XAccessibleEventBroadcaster;
+import complex.toolkit.interface_tests._XAccessibleExtendedComponent;
+import complex.toolkit.interface_tests._XAccessibleText;
+import com.sun.star.awt.XWindow;
+import com.sun.star.chart.XChartDocument;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XExtendedToolkit;
+import java.io.PrintWriter;
+/**
+ *
+ */
+public class CheckAccessibleStatusBarItem extends ComplexTestCase {
+
+ XMultiServiceFactory xMSF = null;
+ XAccessibleContext testObject = null;
+ XWindow xWindow = null;
+
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc",
+// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ shortWait(500) ;
+ }
+
+ /**
+ * Sleeps for a certain time.
+ * @param Thread is sleeping for this time in milliseconds.
+ */
+ private void shortWait(int time) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ public void checkDocs() {
+ Object doc = param.get("DocType");
+ String testDocType;
+ if (doc == null)
+ testDocType = "all";
+ else
+ testDocType = (String)doc;
+
+ System.out.println("Param was " + doc);
+ System.out.println("DocType " + testDocType);
+ if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
+ checkWriterDoc();
+ if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
+ checkMathDoc();
+ if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
+ checkDrawDoc();
+ if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
+ checkImpressDoc();
+ if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
+ checkCalcDoc();
+
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ public void checkWriterDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ log.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ log.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ log.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ log.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ log.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc);
+
+ shortWait();
+ xWindow = (XWindow)UnoRuntime.queryInterface(
+ XWindow.class,tk.getActiveTopWindow());
+
+ shortWait();
+ AccessibilityTools at = new AccessibilityTools();
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ log.println("Get the accessible status bar.");
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ if ( parentContext == null ) {
+ log.println("Could not get the test object: set the correct focus in the next 30 seconds.");
+ shortWait(30000);
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+
+ if ( parentContext == null )
+ failed("Could not create a test object.");
+ }
+ log.println("...OK.");
+
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ int count = testObject.getAccessibleChildCount();
+ log.println("*****");
+ log.println("**** Found items to test: " + count);
+ for (int i=0;i<count;i++){
+ log.println("**** Now testing StatusBarItem " + i + ".");
+ XAccessible object = null;
+ try {
+ object = testObject.getAccessibleChild(i);
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("* Cannot get item Nr: " + i);
+ continue;
+ }
+ XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class,object);
+ String[] services = xSI.getSupportedServiceNames();
+ log.println("* Implementation Name: " + xSI.getImplementationName());
+ String accName = object.getAccessibleContext().getAccessibleName();
+ log.println("* Accessible Name: " + accName);
+ for (int j=0; i<services.length; i++)
+ log.println("* ServiceName "+i+": "+ services[j]);
+ log.println("*****");
+
+ log.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(object, log);
+ assure("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus(), true);
+
+ log.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(object, log);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale(), true);
+
+ log.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(object, log);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont(), true);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText(), true);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText(), true);
+
+ log.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(object, log, "Pfff", xWindow);
+ assure("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener(), true);
+ assure("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener(), true);
+
+ log.println("*** Now testing XAccessibleText ***");
+ _XAccessibleText _xAccText =
+ new _XAccessibleText(object, log, xMSF, "true");
+ assure("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds(), true);
+ assure("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection(), true);
+ assure("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes(), true);
+ assure("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange(), true);
+ assure("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition(), true);
+ }
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
new file mode 100644
index 000000000000..cc184f3c1a73
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import complex.toolkit.interface_tests._XRequestCallback;
+import complex.toolkit.CallbackClass;
+import com.sun.star.awt.XRequestCallback;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.XExtendedToolkit;
+import java.io.PrintWriter;
+
+/**
+ *
+ */
+public class CheckAsyncCallback extends ComplexTestCase {
+
+
+ XInterface testObject = null;
+ XMultiServiceFactory xMSF = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkService"};
+ }
+
+/* public String getTestObjectName() {
+ return "com.sun.star.awt.AccessibleStatusBar";
+ }
+*/
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check services
+ */
+ public void checkService() {
+ checkAsyncCallbackService();
+
+ }
+
+ /**
+ * Test the interfaces
+ */
+ public void checkAsyncCallbackService() {
+ runAllInterfaceTests();
+ }
+
+ public void getTestObject() {
+ try {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+
+ XRequestCallback xAsyncCallback = null;
+
+ XInterface xIfc = (XInterface)xMSF.createInstance(
+ "com.sun.star.awt.AsyncCallback" );
+ xAsyncCallback = (XRequestCallback)
+ UnoRuntime.queryInterface(XRequestCallback.class,xIfc);
+
+ testObject=xAsyncCallback;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ getTestObject();
+ log.println("*** Now testing XRequestCallback ***");
+ _XRequestCallback _xRequestCallback =
+ new _XRequestCallback(testObject, log, xMSF );
+ assure("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback());
+ }
+
+ public void checkCallback() {
+ getTestObject();
+ log.println("*** Now testing asynchronous callback service ***");
+ XRequestCallback xAsyncCallback = null;
+ xAsyncCallback = (XRequestCallback)
+ UnoRuntime.queryInterface( XRequestCallback.class, testObject );
+ CallbackClass aCallbackClass = new CallbackClass( log, xMSF );
+ xAsyncCallback.addCallback( aCallbackClass, null );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java
new file mode 100755
index 000000000000..e3d80629be40
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java
@@ -0,0 +1,489 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import share.LogWriter;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Size;
+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 com.sun.star.uno.XInterface;
+import java.util.Vector;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleComponent</code>
+ * interface methods :
+ * <ul>
+ * <li><code> containsPoint()</code></li>
+ * <li><code> getAccessibleAtPoint()</code></li>
+ * <li><code> getBounds()</code></li>
+ * <li><code> getLocation()</code></li>
+ * <li><code> getLocationOnScreen()</code></li>
+ * <li><code> getSize()</code></li>
+ * <li><code> grabFocus()</code></li>
+ * <li><code> getAccessibleKeyBinding()</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ */
+public class _XAccessibleComponent {
+
+ private LogWriter log;
+
+ public XAccessibleComponent oObj = null;
+
+ private Rectangle bounds = null ;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleComponent";
+
+ /**
+ * Constructor
+ */
+ public _XAccessibleComponent(XInterface object, LogWriter log) {
+ oObj = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, object);
+ this.log = log;
+ }
+
+ /**
+ * First checks 4 inner bounds (upper, lower, left and right)
+ * of component bounding box to contain
+ * at least one point of the component. Second 4 outer bounds
+ * are checked to not contain any component points.<p>
+ *
+ * Has <b> OK </b> status if inner bounds contain component points
+ * and outer bounds don't contain any component points. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have size of a component.</li>
+ * </ul>
+ */
+ public boolean _containsPoint() {
+
+ boolean result = true ;
+
+ int curX = 0;
+ //while (!oObj.containsPoint(new Point(curX, bounds.Y)) && curX < bounds.Width+bounds.X) {
+ while (!oObj.containsPoint(new Point(curX, 0)) && curX < bounds.Width) {
+ curX++;
+ };
+ //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
+ if (curX < bounds.Width) {
+ log.println("Upper bound of box contains point ("
+ + curX + ",0) - OK");
+ } else {
+ log.println
+ ("Upper bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ 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("Contains returns false for ("+curX+","+bounds.Height+")");
+ curX++;
+ };
+ //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
+ if (curX < bounds.Width) {
+ log.println("Lower bound of box contains point ("
+ + curX + "," + (bounds.Height - 1) + ") - OK");
+ } else {
+ log.println
+ ("Lower bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ int curY = 0;
+ //while (!oObj.containsPoint(new Point(bounds.X, curY)) && curY < bounds.Height+bounds.Y) {
+ while (!oObj.containsPoint(new Point(0, curY)) && curY < bounds.Height) {
+ curY++;
+ };
+ //if ((bounds.Y <= curY) && (curY < bounds.Height+bounds.Y)) {
+ if (curY < bounds.Height) {
+ log.println("Left bound of box contains point (0,"
+ + curY + ") - OK");
+ } else {
+ log.println
+ ("Left bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ curY = 0;
+ //while (!oObj.containsPoint(new Point(bounds.X+bounds.Width - 1, curY))
+ // && curY < bounds.Height+bounds.Y) {
+ while (!oObj.containsPoint(new Point(bounds.Width - 1, curY)) && curY < bounds.Height) {
+ curY++;
+ };
+ //if ((bounds.Y <= curY) && (curY < bounds.Height + bounds.Y)) {
+ if (curY < bounds.Height) {
+ log.println("Right bound of box contains point ("
+ + (bounds.Width - 1) + "," + curY + ") - OK");
+ } else {
+ log.println
+ ("Right bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ boolean locRes = true;
+ for (int x = -1; x <= bounds.Width; x++) {
+ locRes &= !oObj.containsPoint(new Point(x, -1));
+ locRes &= !oObj.containsPoint(new Point(x, bounds.Height+bounds.Y));
+ }
+ if (locRes) {
+ log.println("Outer upper and lower bounds contain no component "
+ + "points - OK");
+ } else {
+ log.println("Outer upper and lower bounds CONTAIN some component "
+ + "points - FAILED");
+ result = false;
+ }
+
+ locRes = true;
+ for (int y = -1; y <= bounds.Height; y++) {
+ locRes &= !oObj.containsPoint(new Point(-1, y));
+ locRes &= !oObj.containsPoint(new Point(bounds.X+bounds.Width, y));
+ }
+ if (locRes) {
+ log.println("Outer left and right bounds contain no component "
+ + "points - OK");
+ } else {
+ log.println("Outer left and right bounds CONTAIN some component "
+ + "points - FAILED");
+ result = false;
+ }
+
+ return result;
+ }
+
+ /**
+ * Iterates through all children which implement
+ * <code>XAccessibleComponent</code> (if they exist) determines their
+ * boundaries and tries to get each child by <code>getAccessibleAtPoint</code>
+ * passing point which belongs to the child.
+ * Also the point is checked which doesn't belong to child boundary
+ * box. <p>
+ *
+ * Has <b> OK </b> status if in the first cases the right children
+ * are returned, and in the second <code>null</code> or
+ * another child is returned.
+ */
+ public boolean _getAccessibleAtPoint() {
+
+ boolean result = true ;
+ XAccessibleComponent[] children = getChildrenComponents();
+
+ if (children.length > 0) {
+ for (int i = 0; i < children.length; i++) {
+ 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]));
+
+ log.println("finding the point which lies on the component");
+ int curX = 0;
+ int curY = 0;
+ while (!children[i].containsPoint(new Point(curX, curY))
+ && curX < chBnd.Width) {
+ curX++;
+ curY++;
+ };
+
+ if (curX==chBnd.Width) {
+ log.println("Couldn't find a point with contains");
+ continue;
+ }
+
+ // trying the point laying on child
+ XAccessible xAcc = oObj.getAccessibleAtPoint
+ (new Point(chBnd.X , chBnd.Y));
+ if (xAcc == null) {
+ log.println("The child not found at point ("
+ + (chBnd.X ) + "," + chBnd.Y + ") - FAILED");
+ result = false;
+ } else {
+ XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, children[i]);
+ log.println("Child found at point ("
+ + (chBnd.X ) + "," + chBnd.Y + ") - OK");
+ boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
+ if (!res) {
+ int expIndex = xAccCh.getAccessibleContext().getAccessibleIndexInParent();
+ int gotIndex = xAcc.getAccessibleContext().getAccessibleIndexInParent();
+ if (expIndex < gotIndex) {
+ log.println("The children found is not the same");
+ log.println("The expected child " +
+ xAccCh.getAccessibleContext().getAccessibleName());
+ log.println("is hidden behind the found Child ");
+ log.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK");
+ } else {
+ log.println("The children found is not the same - FAILED");
+ log.println("Expected: "
+ +xAccCh.getAccessibleContext().getAccessibleName());
+ log.println("Found: "
+ +xAcc.getAccessibleContext().getAccessibleName());
+ 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");
+ result &= true;
+ } else {
+ XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, children[i]);
+ boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
+ if (res) {
+ log.println("The same child found outside "
+ + "its bounds - FAILED");
+ result = false ;
+ }
+ }
+ }
+ } else {
+ log.println("There are no children supporting "
+ + "XAccessibleComponent");
+ }
+
+ return result;
+ }
+
+ /**
+ * Retrieves the component bounds and stores it. <p>
+ *
+ * Has <b> OK </b> status if boundary position (x,y) is not negative
+ * and size (Width, Height) is greater than 0.
+ */
+ public boolean _getBounds() {
+ boolean result = true ;
+
+ bounds = oObj.getBounds() ;
+ result &= bounds != null
+ && bounds.X >=0 && bounds.Y >=0
+ && bounds.Width >0 && bounds.Height >0;
+
+ log.println("Bounds = " + (bounds != null
+ ? "(" + bounds.X + "," + bounds.Y + "),("
+ + bounds.Width + "," + bounds.Height + ")" : "null"));
+
+ return result;
+ }
+
+ /**
+ * Gets the location. <p>
+ *
+ * Has <b> OK </b> status if the location is the same as location
+ * of boundary obtained by <code>getBounds()</code> method.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have bounds </li>
+ * </ul>
+ */
+ public boolean _getLocation() {
+
+ boolean result = true ;
+ Point loc = oObj.getLocation() ;
+
+ result &= loc.X == bounds.X && loc.Y == bounds.Y ;
+
+ return result;
+ }
+
+ /**
+ * Get the screen location of the component and its parent
+ * (if it exists and supports <code>XAccessibleComponent</code>). <p>
+ *
+ * Has <b> OK </b> status if component screen location equals
+ * to screen location of its parent plus location of the component
+ * relative to the parent. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have location of the component
+ * relative to its parent</li>
+ * </ul>
+ */
+ public boolean _getLocationOnScreen() {
+
+ XAccessibleComponent parent = getParentComponent();
+
+ boolean result = true ;
+ Point loc = oObj.getLocationOnScreen();
+ log.println("Location is (" + loc.X + "," + loc.Y + ")");
+
+ if (parent != null) {
+ Point parLoc = parent.getLocationOnScreen();
+ log.println("Parent location is ("
+ + parLoc.X + "," + parLoc.Y + ")");
+
+ result &= parLoc.X + bounds.X == loc.X;
+ result &= parLoc.Y + bounds.Y == loc.Y;
+ }
+
+ return result;
+ }
+
+ /**
+ * Obtains the size of the component. <p>
+ *
+ * Has <b> OK </b> status if the size is the same as in bounds. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> </li>
+ * </ul>
+ */
+ public boolean _getSize() {
+
+ boolean result = true ;
+ Size size = oObj.getSize() ;
+
+ result &= size.Width == bounds.Width;
+ result &= size.Height == bounds.Height;
+
+ return result;
+ }
+
+ /**
+ * Just calls the method. <p>
+ *
+ * Has <b> OK </b> status if no runtime exceptions occured.
+ */
+ public boolean _grabFocus() {
+
+ boolean result = true ;
+ oObj.grabFocus() ;
+
+ return result ;
+ }
+
+ /**
+ * Retrieves all children (not more than 50) of the current
+ * component which support <code>XAccessibleComponent</code>.
+ *
+ * @return The array of children. Empty array returned if
+ * such children were not found or some error occured.
+ */
+ private XAccessibleComponent[] getChildrenComponents() {
+ XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ log.println("Component doesn't support XAccessible.");
+ return new XAccessibleComponent[0];
+ }
+ XAccessibleContext xAccCon = xAcc.getAccessibleContext();
+ int cnt = xAccCon.getAccessibleChildCount();
+
+ // for cases when too many children exist checking only first 50
+ if (cnt > 50) cnt = 50 ;
+
+ Vector childComp = new Vector();
+ for (int i = 0; i < cnt; i++) {
+ try {
+ XAccessible child = xAccCon.getAccessibleChild(i);
+ XAccessibleContext xAccConCh = child.getAccessibleContext();
+ XAccessibleComponent xChAccComp = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class,
+ xAccConCh);
+ if (xChAccComp != null) {
+ childComp.add(xChAccComp) ;
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {}
+ }
+
+ return (XAccessibleComponent[]) childComp.toArray
+ (new XAccessibleComponent[childComp.size()]);
+ }
+
+ /**
+ * Gets the parent of the current component which support
+ * <code>XAccessibleComponent</code>.
+ *
+ * @return The parent or <code>null</code> if the component
+ * has no parent or some errors occured.
+ */
+ private XAccessibleComponent getParentComponent() {
+ XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ log.println("Component doesn't support XAccessible.");
+ return null;
+ }
+
+ XAccessibleContext xAccCon = xAcc.getAccessibleContext();
+ XAccessible xAccPar = xAccCon.getAccessibleParent();
+
+ if (xAccPar == null) {
+ log.println("Component has no accessible parent.");
+ return null;
+ }
+ XAccessibleContext xAccConPar = xAccPar.getAccessibleContext();
+ XAccessibleComponent parent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar);
+ if (parent == null) {
+ log.println
+ ("Accessible parent doesn't support XAccessibleComponent");
+ return null;
+ }
+
+ return parent;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getForeground() {
+ int forColor = oObj.getForeground();
+ log.println("getForeground(): " + forColor);
+ return true;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getBackground() {
+ int backColor = oObj.getBackground();
+ log.println("getBackground(): " + backColor);
+ return true;
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java
new file mode 100755
index 000000000000..230eb3d098d3
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.IllegalAccessibleComponentStateException;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleRelationType;
+import util.AccessibilityTools;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleContext</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getAccessibleChildCount()</code></li>
+ * <li><code> getAccessibleChild()</code></li>
+ * <li><code> getAccessibleParent()</code></li>
+ * <li><code> getAccessibleIndexInParent()</code></li>
+ * <li><code> getAccessibleRole()</code></li>
+ * <li><code> getAccessibleDescription()</code></li>
+ * <li><code> getAccessibleName()</code></li>
+ * <li><code> getAccessibleRelationSet()</code></li>
+ * <li><code> getAccessibleStateSet()</code></li>
+ * <li><code> getLocale()</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleContext
+ */
+public class _XAccessibleContext {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleContext" ;
+
+ public XAccessibleContext oObj = null;
+
+ private int childCount = 0;
+ private XAccessible parent = null ;
+
+ public _XAccessibleContext(XInterface object, LogWriter log) {
+ oObj = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, object);
+ this.log = log;
+ }
+
+ /**
+ * Calls the method and stores the number of children. <p>
+ * Has <b> OK </b> status if non-negative number rutrned.
+ */
+ public boolean _getAccessibleChildCount() {
+ childCount = oObj.getAccessibleChildCount();
+ log.println("" + childCount + " children found.");
+ return childCount > -1;
+ }
+
+ /**
+ * Tries to get every child and checks its parent. <p>
+ *
+ * Has <b> OK </b> status if parent of every child
+ * and the tested component are the same objects.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAccessibleChildCount() </code> : to have a number of
+ * children </li>
+ * </ul>
+ */
+ public boolean _getAccessibleChild() {
+ boolean bOK = true;
+ int counter = childCount;
+ if (childCount > 500) counter = 500;
+ for (int i = 0; i < counter; i++) {
+ try {
+ XAccessible ch = oObj.getAccessibleChild(i) ;
+ XAccessibleContext chAC = ch.getAccessibleContext();
+
+ log.println(" Child " + i + ": " +
+ chAC.getAccessibleDescription()) ;
+
+ if (!AccessibilityTools.equals
+ (chAC.getAccessibleParent().getAccessibleContext(), oObj)){
+
+ log.println("Role:");
+ log.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole());
+ log.println("Expected: "+oObj.getAccessibleRole());
+
+ log.println("ImplementationName:");
+ log.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext()));
+ log.println("Expected: "+util.utils.getImplName(oObj));
+
+ log.println("The parent of child and component "+
+ "itself differ.");
+ log.println("Getting(Description): "
+ +chAC.getAccessibleParent().getAccessibleContext().getAccessibleDescription());
+ log.println("Expected(Description): "
+ +oObj.getAccessibleDescription());
+
+ bOK = false;
+ } else {
+ log.println("Getting the expected Child -- OK");
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ bOK = false;
+ }
+ }
+
+ return bOK;
+ }
+
+ /**
+ * Just gets the parent. <p>
+ *
+ * Has <b> OK </b> status if parent is not null.
+ */
+ public boolean _getAccessibleParent() {
+ // assume that the component is not ROOT
+ parent = oObj.getAccessibleParent();
+ return parent != null;
+ }
+
+ /**
+ * Retrieves the index of tested component in its parent.
+ * Then gets the parent's child by this index and compares
+ * it with tested component.<p>
+ *
+ * Has <b> OK </b> status if the parent's child and the tested
+ * component are the same objects.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAccessibleParent() </code> : to have a parent </li>
+ * </ul>
+ */
+ public boolean _getAccessibleIndexInParent() {
+
+ boolean bOK = true;
+ int idx = oObj.getAccessibleIndexInParent();
+
+ XAccessibleContext parentAC = parent.getAccessibleContext() ;
+ try {
+ bOK &= AccessibilityTools.equals(
+ parentAC.getAccessibleChild(idx).getAccessibleContext(),oObj);
+ if (!bOK) {
+ log.println("Expected: "+util.utils.getImplName(oObj));
+ log.println("Getting: "+util.utils.getImplName(
+ parentAC.getAccessibleChild(idx).getAccessibleContext()));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ bOK = false;
+ }
+ return bOK;
+ }
+
+ /**
+ * Get the accessible role of component. <p>
+ *
+ * Has <b> OK </b> status if non-negative number rutrned.
+ */
+ public boolean _getAccessibleRole() {
+ short role = oObj.getAccessibleRole();
+ log.println("The role is " + role);
+ return role > -1;
+ }
+
+ /**
+ * Get the accessible name of the component. <p>
+ *
+ * Has <b> OK </b> status if the name has non-zero length.
+ */
+ public boolean _getAccessibleName() {
+ String name = oObj.getAccessibleName();
+ log.println("The name is '" + name + "'");
+ return name != null;
+ }
+
+ /**
+ * Get the accessible description of the component. <p>
+ *
+ * Has <b> OK </b> status if the description has non-zero length.
+ */
+ public boolean _getAccessibleDescription() {
+ String descr = oObj.getAccessibleDescription();
+ log.println("The description is '" + descr + "'");
+ return descr != null;
+ }
+
+ /**
+ * Just gets the set. <p>
+ *
+ * Has <b> OK </b> status if the set is not null.
+ */
+ public boolean _getAccessibleRelationSet() {
+ XAccessibleRelationSet set = oObj.getAccessibleRelationSet();
+ return set != null;
+ }
+
+ /**
+ * Just gets the set. <p>
+ *
+ * Has <b> OK </b> status if the set is not null.
+ */
+ public boolean _getAccessibleStateSet() {
+ XAccessibleStateSet set = oObj.getAccessibleStateSet();
+ return set != null;
+ }
+
+ /**
+ * Gets the locale. <p>
+ *
+ * Has <b> OK </b> status if <code>Country</code> and
+ * <code>Language</code> fields of locale structure
+ * are not empty.
+ */
+ public boolean _getLocale() {
+ Locale loc = null ;
+ try {
+ loc = oObj.getLocale();
+ log.println("The locale is " + loc.Language + "," + loc.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ return loc != null && loc.Language.length() > 0 &&
+ loc.Country.length() > 0;
+ }
+}
+
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java
new file mode 100755
index 000000000000..18a20d02e233
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.PosSize;
+import com.sun.star.awt.XWindow;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>
+ * com.sun.star.accessibility.XAccessibleEventBroadcaster</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addEventListener()</code></li>
+ * <li><code> removeEventListener()</code></li>
+ * </ul> <p>
+ *
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'EventProducer'</code> (of type
+ * <code>ifc.accessibility._XAccessibleEventBroadcaster.EventProducer</code>):
+ * this must be an implementation of the interface which could perform
+ * some actions for generating any kind of <code>AccessibleEvent</code></li>
+ * <ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ */
+public class _XAccessibleEventBroadcaster {
+
+ private LogWriter log;
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleEventBroadcaster" ;
+
+ public XAccessibleEventBroadcaster oObj = null;
+ public String EventMsg = "";
+ EventProducer prod = null ;
+ EvListener list = new EvListener();
+
+ /**
+ * An event producer
+ */
+ public static class EventProducer {
+ XWindow xWindow;
+ public EventProducer(XWindow window) {
+ xWindow = window;
+ }
+
+ public void fireEvent() {
+ Rectangle newPosSize = xWindow.getPosSize();
+ newPosSize.Width = newPosSize.Width - 20;
+ newPosSize.Height = newPosSize.Height - 20;
+ newPosSize.X = newPosSize.X + 20;
+ newPosSize.Y = newPosSize.Y + 20;
+ xWindow.setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width,
+ newPosSize.Height, PosSize.POSSIZE);
+ }
+ }
+
+ /**
+ * Listener implementation which registers listener calls.
+ */
+ private class EvListener implements XAccessibleEventListener {
+ public AccessibleEventObject notifiedEvent = null ;
+ public void notifyEvent(AccessibleEventObject ev) {
+ log.println("Listener, Event : " + ev.EventId);
+ System.out.println("EventID: " + ev.EventId);
+ Object old=ev.OldValue;
+ if (old instanceof com.sun.star.accessibility.XAccessible) {
+ System.out.println("Old: "+((XAccessible)old).getAccessibleContext().getAccessibleName());
+ }
+
+ Object nev=ev.NewValue;
+ if (nev instanceof com.sun.star.accessibility.XAccessible) {
+ System.out.println("New: "+((XAccessible)nev).getAccessibleContext().getAccessibleName());
+ }
+ notifiedEvent = ev;
+ }
+
+ public void disposing(EventObject ev) {}
+ }
+
+ /**
+ * c'tor
+ */
+ public _XAccessibleEventBroadcaster(XInterface object, LogWriter log, String eventMessage, XWindow window) {
+ oObj = (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
+ XAccessibleEventBroadcaster.class, object);
+ this.log = log;
+ prod = new EventProducer(window);
+ EventMsg = eventMessage;
+ }
+
+ /**
+ * Adds two listeners and fires event by mean of object relation. <p>
+ * Has <b> OK </b> status if both listeners were called
+ */
+ public boolean _addEventListener() {
+ log.println("adding two listeners");
+ oObj.addEventListener(list);
+ boolean isTransient = chkTransient(oObj);
+ log.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(1500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ boolean works = true;
+
+ if (list.notifiedEvent == null) {
+ if (!isTransient) {
+ log.println("listener wasn't called");
+ works = false;
+ } else {
+ log.println("Object is Transient, listener isn't expected to be called");
+ }
+ oObj.removeEventListener(list);
+ }
+
+// log.println(EventMsg);
+ return works;
+ }
+
+ /**
+ * Removes one of two listeners added before and and fires event
+ * by mean of object relation. <p>
+ *
+ * Has <b> OK </b> status if the removed listener wasn't called. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code>addEventListener()</code> : to have added listeners </li>
+ * </ul>
+ */
+ public boolean _removeEventListener() {
+
+ list.notifiedEvent = null;
+
+ log.println("remove first listener");
+ oObj.removeEventListener(list);
+
+ log.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ if (list.notifiedEvent == null) {
+ log.println("listener wasn't called -- OK");
+ }
+
+ return list.notifiedEvent == null;
+
+ }
+
+ protected static boolean chkTransient(Object Testcase) {
+ XAccessibleContext accCon = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class,Testcase);
+ if (accCon.getAccessibleStateSet().contains(
+ com.sun.star.accessibility.AccessibleStateType.TRANSIENT)){
+ if (!accCon.getAccessibleParent().getAccessibleContext().getAccessibleStateSet().contains(
+ com.sun.star.accessibility.AccessibleStateType.MANAGES_DESCENDANTS)) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
+
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java
new file mode 100755
index 000000000000..e022e60d90c0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import lib.MultiMethodTest;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.awt.XFont;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleExtendedComponent</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getForeground()</code></li>
+ * <li><code> getBackground()</code></li>
+ * <li><code> getFont()</code></li>
+ * <li><code> isEnabled()</code></li>
+ * <li><code> getTitledBorderText()</code></li>
+ * <li><code> getToolTipText()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.accessibility.XAccessibleExtendedComponent
+ */
+public class _XAccessibleExtendedComponent {
+
+ private LogWriter log;
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleExtendedComponent" ;
+
+ public XAccessibleExtendedComponent oObj = null;
+
+ // temporary while accessibility package is in com.sun.star
+ protected String getTestedClassName() {
+ return className;
+ }
+
+ public _XAccessibleExtendedComponent(XInterface object, LogWriter log) {
+ oObj = (XAccessibleExtendedComponent)UnoRuntime.queryInterface(
+ XAccessibleExtendedComponent.class, object);
+ this.log = log;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getFont() {
+ XFont font = oObj.getFont();
+ log.println("getFont(): " + font);
+ return true;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ */
+ public boolean _getTitledBorderText() {
+ String titleBorderText = oObj.getTitledBorderText();
+ log.println("getTitledBorderText(): '" + titleBorderText + "'");
+ return titleBorderText != null;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ */
+ public boolean _getToolTipText() {
+ String toolTipText = oObj.getToolTipText();
+ log.println("getToolTipText(): '" + toolTipText + "'");
+ return toolTipText != null;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java
new file mode 100755
index 000000000000..d6357e8f24bc
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java
@@ -0,0 +1,1017 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.accessibility.XAccessibleText;
+import lib.MultiMethodTest;
+//import lib.StatusException;
+//import lib.Status;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Point;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.accessibility.AccessibleTextType;
+import com.sun.star.accessibility.TextSegment;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleText</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getCaretPosition()</code></li>
+ * <li><code> setCaretPosition()</code></li>
+ * <li><code> getCharacter()</code></li>
+ * <li><code> getCharacterAttributes()</code></li>
+ * <li><code> getCharacterBounds()</code></li>
+ * <li><code> getCharacterCount()</code></li>
+ * <li><code> getIndexAtPoint()</code></li>
+ * <li><code> getSelectedText()</code></li>
+ * <li><code> getSelectionStart()</code></li>
+ * <li><code> getSelectionEnd()</code></li>
+ * <li><code> setSelection()</code></li>
+ * <li><code> getText()</code></li>
+ * <li><code> getTextRange()</code></li>
+ * <li><code> getTextAtIndex()</code></li>
+ * <li><code> getTextBeforeIndex()</code></li>
+ * <li><code> getTextBehindIndex()</code></li>
+ * <li><code> copyText()</code></li>
+ * </ul> <p>
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'XAccessibleText.Text'</code> (of type <code>String</code>)
+ * <b> optional </b> :
+ * the string presentation of component's text. If the relation
+ * is not specified, then text from method <code>getText()</code>
+ * is used.
+ * </li>
+ * </ul> <p>
+ * @see com.sun.star.accessibility.XAccessibleText
+ */
+public class _XAccessibleText {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleText" ;
+
+ public XAccessibleText oObj = null;
+ private XMultiServiceFactory xMSF;
+
+ Rectangle chBounds = null;
+ int chCount = 0;
+
+ String text = null;
+ String editOnly = null;
+
+
+ public _XAccessibleText(XInterface object, LogWriter log, XMultiServiceFactory xMSF, String editOnly) {
+ oObj = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, object);
+ this.xMSF = xMSF;
+ this.log = log;
+ this.editOnly = editOnly;
+ }
+
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value is equal to <code>chCount - 1</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setCaretPosition()</code> </li>
+ * </ul>
+ */
+ public boolean _getCaretPosition() {
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+ if ( chCount > 0 ) {
+ try {
+ oObj.setCaretPosition(chCount - 1);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ie) {
+
+ }
+ int carPos = oObj.getCaretPosition();
+ log.println("getCaretPosition: " + carPos);
+ res = carPos == (chCount - 1);
+ }
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong index and with the correct index
+ * <code>chCount - 1</code>.
+ * Has OK status if exception was thrown for wrong index and
+ * if exception wasn't thrown for the correct index.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _setCaretPosition() {
+ boolean res = true;
+
+ try {
+ log.println("setCaretPosition(-1):");
+ oObj.setCaretPosition(-1);
+ res &= false;
+ log.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("setCaretPosition(chCount+1):");
+ oObj.setCaretPosition(chCount+1);
+ res &= false;
+ log.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("expected exception");
+ res &= true;
+ }
+ if ( chCount > 0 ) {
+ try {
+ log.println("setCaretPosition(chCount - 1)");
+ oObj.setCaretPosition(chCount - 1);
+ res &= true;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong index and with the correct indexes.
+ * Checks every character in the text.
+ * Has OK status if exception was thrown for wrong index,
+ * if exception wasn't thrown for the correct index and
+ * if every character is equal to corresponding character in the text.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacter() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacter(-1)");
+ oObj.getCharacter(-1);
+ log.println("Exception was expected");
+ res = false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res = true;
+ }
+
+ try {
+ log.println("getCharacter(chCount)");
+ oObj.getCharacter(chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("Checking of every character in the text...");
+ boolean isEqCh = true;
+ for(int i = 0; i < chCount; i++) {
+ char ch = oObj.getCharacter(i);
+ isEqCh = ch == text.charAt(i);
+ res &= isEqCh;
+ if (!isEqCh) {
+ log.println("At the position " + i +
+ "was expected character: " + text.charAt(i));
+ log.println("but was returned: " + ch);
+ break;
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong indexes and with the correct index,
+ * checks a returned value.
+ * Has OK status if exception was thrown for the wrong indexes,
+ * if exception wasn't thrown for the correct index and
+ * if returned value isn't <code>null</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacterAttributes() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacterAttributes(-1)");
+ oObj.getCharacterAttributes(-1, new String[0]);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getCharacterAttributes(chCount)");
+ oObj.getCharacterAttributes(chCount, new String[0]);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getCharacterAttributes(chCount-1)");
+ PropertyValue[] props = oObj.getCharacterAttributes(chCount - 1, new String[0]);
+ res &= props != null;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+
+ /**
+ * Calls the method with the wrong indexes and with the correct index.
+ * checks and stores a returned value.
+ * Has OK status if exception was thrown for the wrong indexes,
+ * if exception wasn't thrown for the correct index and
+ * if returned value isn't <code>null</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacterBounds() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacterBounds(-1)");
+ oObj.getCharacterBounds(-1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getCharacterBounds(chCount)");
+ oObj.getCharacterBounds(chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 0) {
+ log.println("getCharacterBounds(chCount-1)");
+ chBounds = oObj.getCharacterBounds(chCount-1);
+ res &= chBounds != null;
+ log.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " +
+ chBounds.Width + ", " + chBounds.Height);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+
+ /**
+ * Calls the method and stores a returned value to the variable
+ * <code>chCount</code>.
+ * Has OK status if a returned value is equal to the text length.
+ */
+ public boolean _getCharacterCount() {
+ chCount = oObj.getCharacterCount();
+ log.println("Character count:" + chCount);
+ boolean res = chCount == text.length();
+ return res;
+ }
+
+ /**
+ * Calls the method for an invalid point and for the point of rectangle
+ * returned by the method <code>getCharacterBounds()</code>.
+ * Has OK status if returned value is equal to <code>-1</code> for an
+ * invalid point and if returned value is equal to <code>chCount-1</code>
+ * for a valid point.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterBounds()</code> </li>
+ * </ul>
+ */
+ public boolean _getIndexAtPoint() {
+
+ boolean res = true;
+ log.println("getIndexAtPoint(-1, -1):");
+ Point pt = new Point(-1, -1);
+ int index = oObj.getIndexAtPoint(pt);
+ log.println(Integer.toString(index));
+ res &= index == -1;
+
+ if (chBounds != null) {
+ pt = new Point(chBounds.X , chBounds.Y );
+ log.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):");
+ index = oObj.getIndexAtPoint(pt);
+ log.println(Integer.toString(index));
+ res &= index == (chCount - 1);
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectedText() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, 0)");
+ oObj.setSelection(0, 0);
+ log.println("getSelectedText():");
+ String txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.length() == 0;
+
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ log.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.equals(text);
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ log.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.equals(text.substring(1, chCount - 1));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectionStart() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int start = oObj.getSelectionStart();
+ log.println("getSelectionStart():" + start);
+ res &= start == 0;
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ start = oObj.getSelectionStart();
+ log.println("getSelectionStart():" + start);
+ res &= start == 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectionEnd() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int end = oObj.getSelectionEnd();
+ log.println("getSelectionEnd():" + end);
+ res &= end == chCount;
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ end = oObj.getSelectionEnd();
+ log.println("getSelectionEnd():" + end);
+ res &= end == chCount - 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _setSelection() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ try {
+ log.println("setSelection(-1, chCount-1):");
+ locRes = oObj.setSelection(-1, chCount - 1);
+ log.println(locRes + " exception was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("setSelection(0, chCount+1):");
+ locRes = oObj.setSelection(0, chCount + 1);
+ log.println(locRes + " excepion was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1):");
+ locRes = oObj.setSelection(1, chCount - 1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ log.println("setSelection(chCount-1, 1):");
+ locRes = oObj.setSelection(chCount - 1, 1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ if (chCount > 1) {
+ log.println("setSelection(0, chCount-1):");
+ locRes = oObj.setSelection(0, chCount-1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ log.println("setSelection(chCount-1, 0):");
+ locRes = oObj.setSelection(chCount-1, 0);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ log.println("setSelection(0, 0):");
+ locRes = oObj.setSelection(0, 0);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned string is not null
+ * received from relation.
+ */
+ public boolean _getText() {
+ text = oObj.getText();
+ log.println("getText: '" + text + "'");
+ return (text != null);
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextRange() {
+ boolean res = true;
+ boolean locRes = true;
+
+ try {
+ if (chCount > 3) {
+ log.println("getTextRange(1, chCount - 2): ");
+ String txtRange = oObj.getTextRange(1, chCount - 2);
+ log.println(txtRange);
+ locRes = txtRange.equals(text.substring(1, chCount - 2));
+ res &= locRes;
+ if (!locRes) {
+ log.println("Was expected: " +
+ text.substring(1, chCount - 2));
+ }
+ }
+
+ if (chCount > 0) {
+ log.println("getTextRange(0, chCount-1): ");
+ String txtRange = oObj.getTextRange(0, chCount-1);
+ log.println(txtRange);
+ locRes = txtRange.equals(text.substring(0, chCount - 1));
+ res &= locRes;
+ if (!locRes) {
+ log.println("Was expected: " +
+ text.substring(0, chCount - 1));
+ }
+
+ log.println("getTextRange(chCount, 0): ");
+ txtRange = oObj.getTextRange(chCount, 0);
+ log.println(txtRange);
+ res &= txtRange.equals(text);
+
+ log.println("getTextRange(0, 0): ");
+ txtRange = oObj.getTextRange(0, 0);
+ log.println(txtRange);
+ locRes = txtRange.equals("");
+ res &= locRes;
+ if (!locRes) {
+ log.println("Empty string was expected");
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ try {
+ log.println("getTextRange(-1, chCount - 1): ");
+ String txtRange = oObj.getTextRange(-1, chCount - 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextRange(0, chCount + 1): ");
+ String txtRange = oObj.getTextRange(0, chCount + 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextRange(chCount+1, -1): ");
+ String txtRange = oObj.getTextRange(chCount+1, -1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextAtIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt =
+ oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextAtIndex(chCount+1," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getTextAtIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ log.println("getTextAtIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextAtIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text);
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextBeforeIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ log.println("getTextBeforeIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ TextSegment txt = null;
+ try {
+ if (chCount > 0) {
+ log.println("getTextBeforeIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == chCount ;
+
+ log.println("getTextBeforeIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+
+ if (chCount > 2) {
+ log.println("getTextBeforeIndex(chCount-1," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(chCount - 1,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 2, chCount - 1));
+ log.println("getTextBeforeIndex(2," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(2,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(1, 2));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextBehindIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ log.println("getTextBehindIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getTextBehindIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ log.println("getTextBehindIndex(chCount-1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBehindIndex(chCount - 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+ if ( chCount > 1 ) {
+ log.println("getTextBehindIndex(1," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(1,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(2, 3));
+ }
+ if (chCount > 2) {
+ log.println("getTextBehindIndex(chCount-2," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount - 2,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameter,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameter and if returned value for
+ * valid parameter is equal to <code>true</code>.
+ */
+ public boolean _copyText() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ try {
+ log.println("copyText(-1,chCount):");
+ oObj.copyText(-1, chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("copyText(0,chCount+1):");
+ oObj.copyText(0, chCount + 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("copyText(0,chCount):");
+ locRes = oObj.copyText(0, chCount);
+ log.println(""+locRes);
+ res &= locRes;
+
+ String cbText = null;
+ try {
+ cbText =
+ util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+ log.println("Clipboard: '" + cbText + "'");
+ res &= text.equals(cbText);
+
+ if (chCount > 2) {
+ log.println("copyText(1,chCount-1):");
+ locRes = oObj.copyText(1, chCount - 1);
+ log.println(""+locRes);
+ res &= locRes;
+
+ try {
+ cbText = util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+
+ log.println("Clipboard: '" + cbText + "'");
+ res &= text.substring(1, chCount - 1).equals(cbText);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java
new file mode 100644
index 000000000000..472412e80aa6
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.awt.XRequestCallback;
+import lib.MultiMethodTest;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.awt.XRequestCallback</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addCallback()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.awt.XRequestCallback
+ */
+public class _XRequestCallback {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.awt.XRequestCallback" ;
+
+ public XRequestCallback oObj = null;
+ private XMultiServiceFactory xMSF;
+
+ String text = null;
+
+
+ public _XRequestCallback(XInterface object, LogWriter log, XMultiServiceFactory xMSF ) {
+ oObj = (XRequestCallback)UnoRuntime.queryInterface(
+ XRequestCallback.class, object);
+ this.xMSF = xMSF;
+ this.log = log;
+ }
+
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value is equal to <code>chCount - 1</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>addCallback()</code> </li>
+ * </ul>
+ */
+ public boolean _addCallback() {
+
+ boolean res = true;
+ try {
+ Object a = new Object();
+ oObj.addCallback( null, a );
+ } catch (com.sun.star.uno.RuntimeException ie) {
+ res = false;
+ }
+ log.println("addCallback called" );
+
+ return res;
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk
new file mode 100755
index 000000000000..0e324109f28d
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+TARGET = Toolkit
+PRJNAME = $(TARGET)
+PACKAGE = complex$/toolkit$/interface_tests
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = _XAccessibleComponent.java \
+ _XAccessibleContext.java \
+ _XAccessibleExtendedComponent.java \
+ _XAccessibleEventBroadcaster.java \
+ _XAccessibleText.java \
+ _XRequestCallback.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk
new file mode 100755
index 000000000000..3a4e096719bb
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = Toolkit
+PRJNAME = $(TARGET)
+PACKAGE = complex$/toolkit
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+SUBDIRS = interface_tests
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -tb java_complex
+
+# build up package name with "." instead of $/
+CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+run: \
+ CheckAccessibleStatusBarItem
+
+CheckAccessibleStatusBar:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBar
+
+CheckAccessibleStatusBarItem:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBarItem
+