diff options
author | Lars Langhans <lla@openoffice.org> | 2010-06-03 13:27:56 +0200 |
---|---|---|
committer | Lars Langhans <lla@openoffice.org> | 2010-06-03 13:27:56 +0200 |
commit | b2d7a0c38da2dca04220b0cfcf08557853dfe26a (patch) | |
tree | 4e58b96e07529772ce605de4137e807b3e788e98 /toolkit/qa | |
parent | d07c56eaeed4dab1f1fb2916839597ff0e2c55fe (diff) |
sb123:#111449# change toolkit complex tests
Diffstat (limited to 'toolkit/qa')
14 files changed, 853 insertions, 636 deletions
diff --git a/toolkit/qa/complex/toolkit/CallbackClass.java b/toolkit/qa/complex/toolkit/CallbackClass.java index efc0ef91f7c0..1c9eb68a6d34 100644 --- a/toolkit/qa/complex/toolkit/CallbackClass.java +++ b/toolkit/qa/complex/toolkit/CallbackClass.java @@ -28,11 +28,11 @@ package complex.toolkit; import com.sun.star.awt.XCallback; -import lib.MultiMethodTest; +// import lib.MultiMethodTest; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; +// import com.sun.star.uno.XInterface; +// import com.sun.star.uno.UnoRuntime; +// import share.LogWriter; /** * Testing <code>com.sun.star.awt.XRequestCallback</code> @@ -44,15 +44,15 @@ import share.LogWriter; */ public class CallbackClass implements XCallback{ - private LogWriter log; + // private LogWriter log; private XMultiServiceFactory xMSF; - public CallbackClass(LogWriter log, XMultiServiceFactory xMSF ) { + public CallbackClass(XMultiServiceFactory xMSF ) { this.xMSF = xMSF; - this.log = log; + // this.log = log; } @@ -62,6 +62,6 @@ public class CallbackClass implements XCallback{ */ public void notify( Object aData ) { - log.println("callback called successfully" ); + System.out.println("callback called successfully" ); } } diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java index fee95f2e6de0..7daf9c68bdea 100755 --- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java +++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java @@ -27,7 +27,8 @@ package complex.toolkit; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; +import lib.TestParameters; import util.SOfficeFactory; import util.AccessibilityTools; import complex.toolkit.interface_tests._XAccessibleComponent; @@ -35,7 +36,7 @@ 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.chart.XChartDocument; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XComponent; import com.sun.star.lang.XServiceInfo; @@ -48,26 +49,46 @@ 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; +// import java.io.PrintWriter; + +// import org.junit.After; +import org.junit.AfterClass; +// import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; /** * */ -public class CheckAccessibleStatusBar extends ComplexTestCase { +public class CheckAccessibleStatusBar { XInterface testObject = null; XMultiServiceFactory xMSF = null; XWindow xWindow = null; - public String[] getTestMethodNames() { - return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc", -// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; - } + /** + * The test parameters + */ + private static TestParameters param = null; + +// public String[] getTestMethodNames() { +// return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc", +//// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; +// } /* public String getTestObjectName() { return "com.sun.star.awt.AccessibleStatusBar"; } */ + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + /** * Sleeps for 0.5 sec. to allow StarOffice to react on <code> * reset</code> call. @@ -76,33 +97,47 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { try { Thread.sleep(500) ; } catch (InterruptedException e) { - log.println("While waiting :" + e) ; + System.out.println("While waiting :" + e) ; } } /** * Check document types */ - public void checkDocs() { + @Test 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(); + } } @@ -110,11 +145,11 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { * Test the interfaces on a writer document */ public void checkWriterDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XTextDocument xTextDoc = null; try { - log.println("****** Open a new writer document"); + System.out.println("****** Open a new writer document"); xTextDoc = xSOF.createTextDoc("_blank"); getTestObject(); } @@ -124,7 +159,7 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { runAllInterfaceTests(); if (xTextDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc); try { xClose.close(false); } @@ -138,11 +173,11 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { * Test the interfaces on a math document */ public void checkMathDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xMathDoc = null; try { - log.println("****** Open a new math document"); + System.out.println("****** Open a new math document"); xMathDoc = xSOF.createMathDoc("_blank"); getTestObject(); } @@ -152,7 +187,7 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { runAllInterfaceTests(); if (xMathDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc); try { xClose.close(false); } @@ -166,11 +201,11 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { * Test the interfaces on a draw document */ public void checkDrawDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xDrawDoc = null; try { - log.println("****** Open a new draw document"); + System.out.println("****** Open a new draw document"); xDrawDoc = xSOF.createDrawDoc("_blank"); getTestObject(); } @@ -180,7 +215,7 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { runAllInterfaceTests(); if (xDrawDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); try { xClose.close(false); } @@ -194,11 +229,11 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { * Test the interfaces on an impress document */ public void checkImpressDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xImpressDoc = null; try { - log.println("****** Open a new impress document"); + System.out.println("****** Open a new impress document"); xImpressDoc = xSOF.createImpressDoc("_blank"); getTestObject(); } @@ -208,7 +243,7 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { runAllInterfaceTests(); if (xImpressDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); try { xClose.close(false); } @@ -221,11 +256,11 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { * Test the interfaces on an calc document */ public void checkCalcDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XSpreadsheetDocument xSpreadsheetDoc = null; try { - log.println("****** Open a new calc document"); + System.out.println("****** Open a new calc document"); xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); shortWait(); getTestObject(); @@ -236,7 +271,7 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { runAllInterfaceTests(); if (xSpreadsheetDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); try { xClose.close(false); } @@ -250,32 +285,31 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { try { XInterface xIfc = (XInterface) xMSF.createInstance( "com.sun.star.awt.Toolkit") ; - XExtendedToolkit tk = (XExtendedToolkit) - UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc); + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xIfc); shortWait(); - xWindow = (XWindow)UnoRuntime.queryInterface( - XWindow.class,tk.getActiveTopWindow()); + 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."); + System.out.println("Get the accessible status bar."); parentContext = at.getAccessibleObjectForRole( xRoot, AccessibleRole.STATUS_BAR, ""); shortWait(); - log.println("...OK."); + System.out.println("...OK."); - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class,parentContext); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, parentContext); String[] services = xSI.getSupportedServiceNames(); - log.println("*****"); - log.println("* Implementation Name: " + xSI.getImplementationName()); + System.out.println("*****"); + System.out.println("* Implementation Name: " + xSI.getImplementationName()); for (int i=0; i<services.length; i++) - log.println("* ServiceName "+i+": "+ services[i]); - log.println("*****"); + { + System.out.println("* ServiceName " + i + ": " + services[i]); + } + System.out.println("*****"); testObject=parentContext; } catch(com.sun.star.uno.Exception e) { @@ -288,44 +322,62 @@ public class CheckAccessibleStatusBar extends ComplexTestCase { } public void runAllInterfaceTests() { - log.println("*** Now testing XAccessibleComponent ***"); + System.out.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 ***"); + new _XAccessibleComponent(testObject); + assertTrue("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds()); + assertTrue("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint()); + assertTrue("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint()); + assertTrue("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground()); + assertTrue("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground()); + assertTrue("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation()); + assertTrue("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen()); + assertTrue("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize()); + assertTrue("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus()); + + System.out.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 ***"); + new _XAccessibleContext(testObject); + assertTrue("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount()); + assertTrue("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild()); + assertTrue("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription()); + assertTrue("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName()); + assertTrue("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent()); + assertTrue("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent()); + assertTrue("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet()); + assertTrue("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole()); + assertTrue("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet()); + assertTrue("failed: XAccessibleContext::getLocale", _xAccContext._getLocale()); + + System.out.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()); + new _XAccessibleExtendedComponent(testObject); + assertTrue("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); + assertTrue("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); + assertTrue("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); - log.println("*** Now testing XAccessibleEventBroadcaster ***"); + System.out.println("*** Now testing XAccessibleEventBroadcaster ***"); _XAccessibleEventBroadcaster _xAccEvBcast = - new _XAccessibleEventBroadcaster(testObject, log, "Pfff", xWindow); - assure("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); - assure("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); + new _XAccessibleEventBroadcaster(testObject, "Pfff", xWindow); + assertTrue("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); + assertTrue("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); } + + + + + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java index 36394732ce78..f626a0bb68b8 100755 --- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java +++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java @@ -27,9 +27,10 @@ package complex.toolkit; -import complexlib.ComplexTestCase; -import util.SOfficeFactory; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; +import lib.TestParameters; +// import util.SOfficeFactory; +// import complexlib.ComplexTestCase; import util.SOfficeFactory; import util.AccessibilityTools; import complex.toolkit.interface_tests._XAccessibleComponent; @@ -38,7 +39,7 @@ 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.chart.XChartDocument; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XComponent; import com.sun.star.lang.XServiceInfo; @@ -51,21 +52,35 @@ 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; +// import java.io.PrintWriter; + + +// import org.junit.After; +import org.junit.AfterClass; +// import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + /** * */ -public class CheckAccessibleStatusBarItem extends ComplexTestCase { +public class CheckAccessibleStatusBarItem { XMultiServiceFactory xMSF = null; XAccessibleContext testObject = null; XWindow xWindow = null; + /** + * The test parameters + */ + private static TestParameters param = null; - public String[] getTestMethodNames() { - return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc", -// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc", +//// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; +// } /** * Sleeps for 0.5 sec. to allow StarOffice to react on <code> @@ -83,45 +98,67 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { try { Thread.sleep(500); } catch (InterruptedException e) { - log.println("While waiting :" + e) ; + System.out.println("While waiting :" + e) ; } } /** * Check document types */ - public void checkDocs() { + @Test public void checkDocs() + { + param = new TestParameters(); 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(); + } } + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + /** * Test the interfaces on a writer document */ - public void checkWriterDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + private void checkWriterDoc() { + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XTextDocument xTextDoc = null; try { - log.println("****** Open a new writer document"); + System.out.println("****** Open a new writer document"); xTextDoc = xSOF.createTextDoc("_blank"); getTestObject(); } @@ -131,7 +168,7 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { runAllInterfaceTests(); if (xTextDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc); try { xClose.close(false); } @@ -145,11 +182,11 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { * Test the interfaces on a math document */ public void checkMathDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xMathDoc = null; try { - log.println("****** Open a new math document"); + System.out.println("****** Open a new math document"); xMathDoc = xSOF.createMathDoc("_blank"); getTestObject(); } @@ -159,7 +196,7 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { runAllInterfaceTests(); if (xMathDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc); try { xClose.close(false); } @@ -173,11 +210,11 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { * Test the interfaces on a draw document */ public void checkDrawDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xDrawDoc = null; try { - log.println("****** Open a new draw document"); + System.out.println("****** Open a new draw document"); xDrawDoc = xSOF.createDrawDoc("_blank"); getTestObject(); } @@ -187,7 +224,7 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { runAllInterfaceTests(); if (xDrawDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); try { xClose.close(false); } @@ -201,11 +238,11 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { * Test the interfaces on an impress document */ public void checkImpressDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XComponent xImpressDoc = null; try { - log.println("****** Open a new impress document"); + System.out.println("****** Open a new impress document"); xImpressDoc = xSOF.createImpressDoc("_blank"); getTestObject(); } @@ -215,7 +252,7 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { runAllInterfaceTests(); if (xImpressDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); try { xClose.close(false); } @@ -228,11 +265,11 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { * Test the interfaces on an calc document */ public void checkCalcDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = getMSF(); SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); XSpreadsheetDocument xSpreadsheetDoc = null; try { - log.println("****** Open a new calc document"); + System.out.println("****** Open a new calc document"); xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); shortWait(); getTestObject(); @@ -243,7 +280,7 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { runAllInterfaceTests(); if (xSpreadsheetDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); try { xClose.close(false); } @@ -257,11 +294,11 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { try { XInterface xIfc = (XInterface) xMSF.createInstance( "com.sun.star.awt.Toolkit") ; - XExtendedToolkit tk = (XExtendedToolkit) + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc); shortWait(); - xWindow = (XWindow)UnoRuntime.queryInterface( + xWindow = UnoRuntime.queryInterface( XWindow.class,tk.getActiveTopWindow()); shortWait(); @@ -269,20 +306,22 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { XAccessible xRoot = at.getAccessibleObject(xWindow); XAccessibleContext parentContext = null; - log.println("Get the accessible status bar."); + System.out.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."); + System.out.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."); + { + fail("Could not create a test object."); + } } - log.println("...OK."); + System.out.println("...OK."); testObject=parentContext; } @@ -297,10 +336,10 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { public void runAllInterfaceTests() { int count = testObject.getAccessibleChildCount(); - log.println("*****"); - log.println("**** Found items to test: " + count); + System.out.println("*****"); + System.out.println("**** Found items to test: " + count); for (int i=0;i<count;i++){ - log.println("**** Now testing StatusBarItem " + i + "."); + System.out.println("**** Now testing StatusBarItem " + i + "."); XAccessible object = null; try { object = testObject.getAccessibleChild(i); @@ -309,77 +348,97 @@ public class CheckAccessibleStatusBarItem extends ComplexTestCase { System.out.println("* Cannot get item Nr: " + i); continue; } - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo xSI = UnoRuntime.queryInterface( XServiceInfo.class,object); String[] services = xSI.getSupportedServiceNames(); - log.println("* Implementation Name: " + xSI.getImplementationName()); + System.out.println("* Implementation Name: " + xSI.getImplementationName()); String accName = object.getAccessibleContext().getAccessibleName(); - log.println("* Accessible Name: " + accName); + System.out.println("* Accessible Name: " + accName); for (int j=0; i<services.length; i++) - log.println("* ServiceName "+i+": "+ services[j]); - log.println("*****"); + { + System.out.println("* ServiceName "+i+": "+ services[j]); + } + System.out.println("*****"); - log.println("*** Now testing XAccessibleComponent ***"); + System.out.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 ***"); + new _XAccessibleComponent(object); + assertTrue("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds()); + assertTrue("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize()); + assertTrue("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus()); + + System.out.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 ***"); + new _XAccessibleContext(object); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet()); + assertTrue("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale()); + + System.out.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); + new _XAccessibleExtendedComponent(object); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); - log.println("*** Now testing XAccessibleEventBroadcaster ***"); + System.out.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); + new _XAccessibleEventBroadcaster(object, "Pfff", xWindow); + assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); + assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); - log.println("*** Now testing XAccessibleText ***"); + System.out.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); + new _XAccessibleText(object, xMSF, "true"); + assertTrue("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds()); + assertTrue("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection()); + assertTrue("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes()); + assertTrue("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange()); + assertTrue("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition()); + assertTrue("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition()); } } + + + + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + + } diff --git a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java index cc184f3c1a73..a83f607e030b 100644 --- a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java +++ b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java @@ -27,36 +27,50 @@ package complex.toolkit; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import util.SOfficeFactory; import complex.toolkit.interface_tests._XRequestCallback; -import complex.toolkit.CallbackClass; +// 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.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; +// import com.sun.star.awt.XExtendedToolkit; +// import java.io.PrintWriter; + +// import org.junit.After; +import org.junit.AfterClass; +// import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; /** * */ -public class CheckAsyncCallback extends ComplexTestCase { +public class CheckAsyncCallback /* extends ComplexTestCase*/ { XInterface testObject = null; XMultiServiceFactory xMSF = null; - public String[] getTestMethodNames() { - return new String[]{"checkService"}; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkService"}; +// } /* public String getTestObjectName() { return "com.sun.star.awt.AccessibleStatusBar"; } */ + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + /** * Sleeps for 0.5 sec. to allow StarOffice to react on <code> * reset</code> call. @@ -65,14 +79,14 @@ public class CheckAsyncCallback extends ComplexTestCase { try { Thread.sleep(500) ; } catch (InterruptedException e) { - log.println("While waiting :" + e) ; + System.out.println("While waiting :" + e) ; } } /** * Check services */ - public void checkService() { + @Test public void checkService() { checkAsyncCallbackService(); } @@ -86,15 +100,14 @@ public class CheckAsyncCallback extends ComplexTestCase { public void getTestObject() { try { - xMSF = (XMultiServiceFactory)param.getMSF(); + xMSF = 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); + xAsyncCallback = UnoRuntime.queryInterface(XRequestCallback.class, xIfc); testObject=xAsyncCallback; } @@ -109,19 +122,36 @@ public class CheckAsyncCallback extends ComplexTestCase { public void runAllInterfaceTests() { getTestObject(); - log.println("*** Now testing XRequestCallback ***"); + System.out.println("*** Now testing XRequestCallback ***"); _XRequestCallback _xRequestCallback = - new _XRequestCallback(testObject, log, xMSF ); - assure("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback()); + new _XRequestCallback(testObject, xMSF ); + assertTrue("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback()); } public void checkCallback() { getTestObject(); - log.println("*** Now testing asynchronous callback service ***"); + System.out.println("*** Now testing asynchronous callback service ***"); XRequestCallback xAsyncCallback = null; - xAsyncCallback = (XRequestCallback) - UnoRuntime.queryInterface( XRequestCallback.class, testObject ); - CallbackClass aCallbackClass = new CallbackClass( log, xMSF ); + xAsyncCallback = UnoRuntime.queryInterface(XRequestCallback.class, testObject); + CallbackClass aCallbackClass = new CallbackClass( xMSF ); xAsyncCallback.addCallback( aCallbackClass, null ); } + + + + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + + } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java index e3d80629be40..9d27c7b7d23a 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java @@ -27,7 +27,7 @@ package complex.toolkit.interface_tests; -import share.LogWriter; +// import share.LogWriter; import com.sun.star.awt.Point; import com.sun.star.awt.Rectangle; import com.sun.star.awt.Size; @@ -56,7 +56,7 @@ import java.util.Vector; */ public class _XAccessibleComponent { - private LogWriter log; + // private LogWriter log; public XAccessibleComponent oObj = null; @@ -67,11 +67,12 @@ public class _XAccessibleComponent { /** * Constructor + * @param object */ - public _XAccessibleComponent(XInterface object, LogWriter log) { - oObj = (XAccessibleComponent)UnoRuntime.queryInterface( + public _XAccessibleComponent(XInterface object/*, LogWriter log*/) { + oObj = UnoRuntime.queryInterface( XAccessibleComponent.class, object); - this.log = log; + // this.log = log; } /** @@ -87,7 +88,8 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> : to have size of a component.</li> * </ul> - */ + * @return + */ public boolean _containsPoint() { boolean result = true ; @@ -96,13 +98,13 @@ public class _XAccessibleComponent { //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 (" + System.out.println("Upper bound of box contains point (" + curX + ",0) - OK"); } else { - log.println + System.out.println ("Upper bound of box contains no component points - FAILED"); result = false; } @@ -112,15 +114,15 @@ public class _XAccessibleComponent { while (!oObj.containsPoint(new Point(curX, bounds.Height - 1)) && curX < bounds.Width) { - log.println("Contains returns false for ("+curX+","+bounds.Height+")"); + System.out.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 (" + System.out.println("Lower bound of box contains point (" + curX + "," + (bounds.Height - 1) + ") - OK"); } else { - log.println + System.out.println ("Lower bound of box contains no component points - FAILED"); result = false; } @@ -129,13 +131,13 @@ public class _XAccessibleComponent { //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," + System.out.println("Left bound of box contains point (0," + curY + ") - OK"); } else { - log.println + System.out.println ("Left bound of box contains no component points - FAILED"); result = false; } @@ -145,13 +147,13 @@ public class _XAccessibleComponent { // && 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 (" + System.out.println("Right bound of box contains point (" + (bounds.Width - 1) + "," + curY + ") - OK"); } else { - log.println + System.out.println ("Right bound of box contains no component points - FAILED"); result = false; } @@ -162,10 +164,10 @@ public class _XAccessibleComponent { locRes &= !oObj.containsPoint(new Point(x, bounds.Height+bounds.Y)); } if (locRes) { - log.println("Outer upper and lower bounds contain no component " + System.out.println("Outer upper and lower bounds contain no component " + "points - OK"); } else { - log.println("Outer upper and lower bounds CONTAIN some component " + System.out.println("Outer upper and lower bounds CONTAIN some component " + "points - FAILED"); result = false; } @@ -176,10 +178,10 @@ public class _XAccessibleComponent { locRes &= !oObj.containsPoint(new Point(bounds.X+bounds.Width, y)); } if (locRes) { - log.println("Outer left and right bounds contain no component " + System.out.println("Outer left and right bounds contain no component " + "points - OK"); } else { - log.println("Outer left and right bounds CONTAIN some component " + System.out.println("Outer left and right bounds CONTAIN some component " + "points - FAILED"); result = false; } @@ -198,6 +200,7 @@ public class _XAccessibleComponent { * 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. + * @return */ public boolean _getAccessibleAtPoint() { @@ -207,23 +210,26 @@ public class _XAccessibleComponent { 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 " + + if (chBnd.X == -1) + { + continue; + } + System.out.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"); + System.out.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"); + System.out.println("Couldn't find a point with contains"); continue; } @@ -231,29 +237,29 @@ public class _XAccessibleComponent { XAccessible xAcc = oObj.getAccessibleAtPoint (new Point(chBnd.X , chBnd.Y)); if (xAcc == null) { - log.println("The child not found at point (" + System.out.println("The child not found at point (" + (chBnd.X ) + "," + chBnd.Y + ") - FAILED"); result = false; } else { - XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface + XAccessible xAccCh = UnoRuntime.queryInterface (XAccessible.class, children[i]); - log.println("Child found at point (" + System.out.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 " + + System.out.println("The children found is not the same"); + System.out.println("The expected child " + xAccCh.getAccessibleContext().getAccessibleName()); - log.println("is hidden behind the found Child "); - log.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK"); + System.out.println("is hidden behind the found Child "); + System.out.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK"); } else { - log.println("The children found is not the same - FAILED"); - log.println("Expected: " + System.out.println("The children found is not the same - FAILED"); + System.out.println("Expected: " +xAccCh.getAccessibleContext().getAccessibleName()); - log.println("Found: " + System.out.println("Found: " +xAcc.getAccessibleContext().getAccessibleName()); result = false ; } @@ -264,22 +270,21 @@ public class _XAccessibleComponent { xAcc = oObj.getAccessibleAtPoint (new Point(chBnd.X - 1, chBnd.Y - 1)); if (xAcc == null) { - log.println("No children found at point (" + System.out.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]); + XAccessible xAccCh = UnoRuntime.queryInterface(XAccessible.class, children[i]); boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); if (res) { - log.println("The same child found outside " + System.out.println("The same child found outside " + "its bounds - FAILED"); result = false ; } } } } else { - log.println("There are no children supporting " + System.out.println("There are no children supporting " + "XAccessibleComponent"); } @@ -291,6 +296,7 @@ public class _XAccessibleComponent { * * Has <b> OK </b> status if boundary position (x,y) is not negative * and size (Width, Height) is greater than 0. + * @return */ public boolean _getBounds() { boolean result = true ; @@ -300,7 +306,7 @@ public class _XAccessibleComponent { && bounds.X >=0 && bounds.Y >=0 && bounds.Width >0 && bounds.Height >0; - log.println("Bounds = " + (bounds != null + System.out.println("Bounds = " + (bounds != null ? "(" + bounds.X + "," + bounds.Y + "),(" + bounds.Width + "," + bounds.Height + ")" : "null")); @@ -317,6 +323,7 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> : to have bounds </li> * </ul> + * @return */ public boolean _getLocation() { @@ -341,6 +348,7 @@ public class _XAccessibleComponent { * <li> <code> getBounds() </code> : to have location of the component * relative to its parent</li> * </ul> + * @return */ public boolean _getLocationOnScreen() { @@ -348,11 +356,11 @@ public class _XAccessibleComponent { boolean result = true ; Point loc = oObj.getLocationOnScreen(); - log.println("Location is (" + loc.X + "," + loc.Y + ")"); + System.out.println("Location is (" + loc.X + "," + loc.Y + ")"); if (parent != null) { Point parLoc = parent.getLocationOnScreen(); - log.println("Parent location is (" + System.out.println("Parent location is (" + parLoc.X + "," + parLoc.Y + ")"); result &= parLoc.X + bounds.X == loc.X; @@ -371,6 +379,7 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> </li> * </ul> + * @return */ public boolean _getSize() { @@ -387,6 +396,7 @@ public class _XAccessibleComponent { * Just calls the method. <p> * * Has <b> OK </b> status if no runtime exceptions occured. + * @return */ public boolean _grabFocus() { @@ -404,26 +414,26 @@ public class _XAccessibleComponent { * such children were not found or some error occured. */ private XAccessibleComponent[] getChildrenComponents() { - XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface - (XAccessible.class, oObj) ; + XAccessible xAcc = UnoRuntime.queryInterface(XAccessible.class, oObj) ; if (xAcc == null) { - log.println("Component doesn't support XAccessible."); + System.out.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 ; + 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); + XAccessibleComponent xChAccComp = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConCh); if (xChAccComp != null) { childComp.add(xChAccComp) ; } @@ -442,10 +452,9 @@ public class _XAccessibleComponent { * has no parent or some errors occured. */ private XAccessibleComponent getParentComponent() { - XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface - (XAccessible.class, oObj) ; + XAccessible xAcc = UnoRuntime.queryInterface(XAccessible.class, oObj) ; if (xAcc == null) { - log.println("Component doesn't support XAccessible."); + System.out.println("Component doesn't support XAccessible."); return null; } @@ -453,14 +462,13 @@ public class _XAccessibleComponent { XAccessible xAccPar = xAccCon.getAccessibleParent(); if (xAccPar == null) { - log.println("Component has no accessible parent."); + System.out.println("Component has no accessible parent."); return null; } XAccessibleContext xAccConPar = xAccPar.getAccessibleContext(); - XAccessibleComponent parent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar); + XAccessibleComponent parent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar); if (parent == null) { - log.println + System.out.println ("Accessible parent doesn't support XAccessibleComponent"); return null; } @@ -470,19 +478,21 @@ public class _XAccessibleComponent { /** * Just calls the method. + * @return */ public boolean _getForeground() { int forColor = oObj.getForeground(); - log.println("getForeground(): " + forColor); + System.out.println("getForeground(): " + forColor); return true; } /** * Just calls the method. + * @return */ public boolean _getBackground() { int backColor = oObj.getBackground(); - log.println("getBackground(): " + backColor); + System.out.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 index 230eb3d098d3..20c99d3e129e 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java @@ -35,9 +35,9 @@ 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 com.sun.star.accessibility.AccessibleRelationType; import util.AccessibilityTools; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleContext</code> @@ -59,7 +59,7 @@ import share.LogWriter; */ public class _XAccessibleContext { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleContext" ; @@ -69,19 +69,19 @@ public class _XAccessibleContext { private int childCount = 0; private XAccessible parent = null ; - public _XAccessibleContext(XInterface object, LogWriter log) { - oObj = (XAccessibleContext)UnoRuntime.queryInterface( - XAccessibleContext.class, object); - this.log = log; + public _XAccessibleContext(XInterface object) { + oObj = 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. + * @return */ public boolean _getAccessibleChildCount() { childCount = oObj.getAccessibleChildCount(); - log.println("" + childCount + " children found."); + System.out.println("" + childCount + " children found."); return childCount > -1; } @@ -96,40 +96,44 @@ public class _XAccessibleContext { * <li> <code> getAccessibleChildCount() </code> : to have a number of * children </li> * </ul> + * @return */ public boolean _getAccessibleChild() { boolean bOK = true; int counter = childCount; - if (childCount > 500) counter = 500; + 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 + ": " + + System.out.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()); + System.out.println("Role:"); + System.out.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole()); + System.out.println("Expected: "+oObj.getAccessibleRole()); - log.println("ImplementationName:"); - log.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext())); - log.println("Expected: "+util.utils.getImplName(oObj)); + System.out.println("ImplementationName:"); + System.out.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext())); + System.out.println("Expected: "+util.utils.getImplName(oObj)); - log.println("The parent of child and component "+ + System.out.println("The parent of child and component "+ "itself differ."); - log.println("Getting(Description): " + System.out.println("Getting(Description): " +chAC.getAccessibleParent().getAccessibleContext().getAccessibleDescription()); - log.println("Expected(Description): " + System.out.println("Expected(Description): " +oObj.getAccessibleDescription()); bOK = false; } else { - log.println("Getting the expected Child -- OK"); + System.out.println("Getting the expected Child -- OK"); } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(); @@ -144,6 +148,7 @@ public class _XAccessibleContext { * Just gets the parent. <p> * * Has <b> OK </b> status if parent is not null. + * @return */ public boolean _getAccessibleParent() { // assume that the component is not ROOT @@ -163,6 +168,7 @@ public class _XAccessibleContext { * <ul> * <li> <code> getAccessibleParent() </code> : to have a parent </li> * </ul> + * @return */ public boolean _getAccessibleIndexInParent() { @@ -174,8 +180,8 @@ public class _XAccessibleContext { bOK &= AccessibilityTools.equals( parentAC.getAccessibleChild(idx).getAccessibleContext(),oObj); if (!bOK) { - log.println("Expected: "+util.utils.getImplName(oObj)); - log.println("Getting: "+util.utils.getImplName( + System.out.println("Expected: "+util.utils.getImplName(oObj)); + System.out.println("Getting: "+util.utils.getImplName( parentAC.getAccessibleChild(idx).getAccessibleContext())); } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -189,10 +195,11 @@ public class _XAccessibleContext { * Get the accessible role of component. <p> * * Has <b> OK </b> status if non-negative number rutrned. + * @return */ public boolean _getAccessibleRole() { short role = oObj.getAccessibleRole(); - log.println("The role is " + role); + System.out.println("The role is " + role); return role > -1; } @@ -200,10 +207,11 @@ public class _XAccessibleContext { * Get the accessible name of the component. <p> * * Has <b> OK </b> status if the name has non-zero length. + * @return */ public boolean _getAccessibleName() { String name = oObj.getAccessibleName(); - log.println("The name is '" + name + "'"); + System.out.println("The name is '" + name + "'"); return name != null; } @@ -211,10 +219,11 @@ public class _XAccessibleContext { * Get the accessible description of the component. <p> * * Has <b> OK </b> status if the description has non-zero length. + * @return */ public boolean _getAccessibleDescription() { String descr = oObj.getAccessibleDescription(); - log.println("The description is '" + descr + "'"); + System.out.println("The description is '" + descr + "'"); return descr != null; } @@ -222,6 +231,7 @@ public class _XAccessibleContext { * Just gets the set. <p> * * Has <b> OK </b> status if the set is not null. + * @return */ public boolean _getAccessibleRelationSet() { XAccessibleRelationSet set = oObj.getAccessibleRelationSet(); @@ -232,6 +242,7 @@ public class _XAccessibleContext { * Just gets the set. <p> * * Has <b> OK </b> status if the set is not null. + * @return */ public boolean _getAccessibleStateSet() { XAccessibleStateSet set = oObj.getAccessibleStateSet(); @@ -244,12 +255,13 @@ public class _XAccessibleContext { * Has <b> OK </b> status if <code>Country</code> and * <code>Language</code> fields of locale structure * are not empty. + * @return */ public boolean _getLocale() { Locale loc = null ; try { loc = oObj.getLocale(); - log.println("The locale is " + loc.Language + "," + loc.Country); + System.out.println("The locale is " + loc.Language + "," + loc.Country); } catch (IllegalAccessibleComponentStateException e) { e.printStackTrace(); } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java index 18a20d02e233..dc14e8057a5a 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java @@ -33,13 +33,13 @@ 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.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; +// import share.LogWriter; /** * Testing <code> @@ -62,7 +62,7 @@ import share.LogWriter; */ public class _XAccessibleEventBroadcaster { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleEventBroadcaster" ; @@ -97,7 +97,7 @@ public class _XAccessibleEventBroadcaster { private class EvListener implements XAccessibleEventListener { public AccessibleEventObject notifiedEvent = null ; public void notifyEvent(AccessibleEventObject ev) { - log.println("Listener, Event : " + ev.EventId); + System.out.println("Listener, Event : " + ev.EventId); System.out.println("EventID: " + ev.EventId); Object old=ev.OldValue; if (old instanceof com.sun.star.accessibility.XAccessible) { @@ -116,11 +116,13 @@ public class _XAccessibleEventBroadcaster { /** * c'tor + * @param object + * @param eventMessage + * @param window */ - public _XAccessibleEventBroadcaster(XInterface object, LogWriter log, String eventMessage, XWindow window) { - oObj = (XAccessibleEventBroadcaster)UnoRuntime.queryInterface( - XAccessibleEventBroadcaster.class, object); - this.log = log; + public _XAccessibleEventBroadcaster(XInterface object, String eventMessage, XWindow window) { + oObj = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, object); + // this.log = log; prod = new EventProducer(window); EventMsg = eventMessage; } @@ -128,12 +130,13 @@ public class _XAccessibleEventBroadcaster { /** * Adds two listeners and fires event by mean of object relation. <p> * Has <b> OK </b> status if both listeners were called + * @return */ public boolean _addEventListener() { - log.println("adding two listeners"); + System.out.println("adding two listeners"); oObj.addEventListener(list); boolean isTransient = chkTransient(oObj); - log.println("fire event"); + System.out.println("fire event"); prod.fireEvent() ; try { @@ -146,15 +149,15 @@ public class _XAccessibleEventBroadcaster { if (list.notifiedEvent == null) { if (!isTransient) { - log.println("listener wasn't called"); + System.out.println("listener wasn't called"); works = false; } else { - log.println("Object is Transient, listener isn't expected to be called"); + System.out.println("Object is Transient, listener isn't expected to be called"); } oObj.removeEventListener(list); } -// log.println(EventMsg); +// System.out.println(EventMsg); return works; } @@ -168,15 +171,16 @@ public class _XAccessibleEventBroadcaster { * <ul> * <li> <code>addEventListener()</code> : to have added listeners </li> * </ul> + * @return */ public boolean _removeEventListener() { list.notifiedEvent = null; - log.println("remove first listener"); + System.out.println("remove first listener"); oObj.removeEventListener(list); - log.println("fire event"); + System.out.println("fire event"); prod.fireEvent() ; try { @@ -186,7 +190,7 @@ public class _XAccessibleEventBroadcaster { } if (list.notifiedEvent == null) { - log.println("listener wasn't called -- OK"); + System.out.println("listener wasn't called -- OK"); } return list.notifiedEvent == null; @@ -194,8 +198,7 @@ public class _XAccessibleEventBroadcaster { } protected static boolean chkTransient(Object Testcase) { - XAccessibleContext accCon = (XAccessibleContext) - UnoRuntime.queryInterface(XAccessibleContext.class,Testcase); + XAccessibleContext accCon = UnoRuntime.queryInterface(XAccessibleContext.class, Testcase); if (accCon.getAccessibleStateSet().contains( com.sun.star.accessibility.AccessibleStateType.TRANSIENT)){ if (!accCon.getAccessibleParent().getAccessibleContext().getAccessibleStateSet().contains( diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java index e022e60d90c0..45535fa0007c 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java @@ -27,14 +27,14 @@ package complex.toolkit.interface_tests; -import lib.MultiMethodTest; +// 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.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; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleExtendedComponent</code> @@ -51,7 +51,7 @@ import share.LogWriter; */ public class _XAccessibleExtendedComponent { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleExtendedComponent" ; @@ -62,38 +62,40 @@ public class _XAccessibleExtendedComponent { return className; } - public _XAccessibleExtendedComponent(XInterface object, LogWriter log) { - oObj = (XAccessibleExtendedComponent)UnoRuntime.queryInterface( - XAccessibleExtendedComponent.class, object); - this.log = log; + public _XAccessibleExtendedComponent(XInterface object/*, LogWriter log*/) { + oObj = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, object); + // this.log = log; } /** * Just calls the method. + * @return */ public boolean _getFont() { XFont font = oObj.getFont(); - log.println("getFont(): " + font); + System.out.println("getFont(): " + font); return true; } /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. + * @return */ public boolean _getTitledBorderText() { String titleBorderText = oObj.getTitledBorderText(); - log.println("getTitledBorderText(): '" + titleBorderText + "'"); + System.out.println("getTitledBorderText(): '" + titleBorderText + "'"); return titleBorderText != null; } /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. + * @return */ public boolean _getToolTipText() { String toolTipText = oObj.getToolTipText(); - log.println("getToolTipText(): '" + toolTipText + "'"); + System.out.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 index d6357e8f24bc..2075a0ef30a5 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java @@ -28,7 +28,7 @@ package complex.toolkit.interface_tests; import com.sun.star.accessibility.XAccessibleText; -import lib.MultiMethodTest; +// import lib.MultiMethodTest; //import lib.StatusException; //import lib.Status; import com.sun.star.beans.PropertyValue; @@ -39,7 +39,7 @@ 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; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleText</code> @@ -76,7 +76,7 @@ import share.LogWriter; */ public class _XAccessibleText { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleText" ; @@ -91,11 +91,10 @@ public class _XAccessibleText { String editOnly = null; - public _XAccessibleText(XInterface object, LogWriter log, XMultiServiceFactory xMSF, String editOnly) { - oObj = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, object); + public _XAccessibleText(XInterface object, XMultiServiceFactory xMSF, String editOnly) { + oObj = UnoRuntime.queryInterface(XAccessibleText.class, object); this.xMSF = xMSF; - this.log = log; + // this.log = log; this.editOnly = editOnly; } @@ -107,11 +106,12 @@ public class _XAccessibleText { * <ul> * <li> <code>setCaretPosition()</code> </li> * </ul> + * @return */ public boolean _getCaretPosition() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } @@ -123,7 +123,7 @@ public class _XAccessibleText { } int carPos = oObj.getCaretPosition(); - log.println("getCaretPosition: " + carPos); + System.out.println("getCaretPosition: " + carPos); res = carPos == (chCount - 1); } return res; @@ -138,36 +138,37 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _setCaretPosition() { boolean res = true; try { - log.println("setCaretPosition(-1):"); + System.out.println("setCaretPosition(-1):"); oObj.setCaretPosition(-1); res &= false; - log.println("exception was expected"); + System.out.println("exception was expected"); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("expected exception"); + System.out.println("expected exception"); res &= true; } try { - log.println("setCaretPosition(chCount+1):"); + System.out.println("setCaretPosition(chCount+1):"); oObj.setCaretPosition(chCount+1); res &= false; - log.println("exception was expected"); + System.out.println("exception was expected"); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("expected exception"); + System.out.println("expected exception"); res &= true; } if ( chCount > 0 ) { try { - log.println("setCaretPosition(chCount - 1)"); + System.out.println("setCaretPosition(chCount - 1)"); oObj.setCaretPosition(chCount - 1); res &= true; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("unexpected exception"); + System.out.println("unexpected exception"); e.printStackTrace(); res &= false; } @@ -186,46 +187,47 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacter() { boolean res = true; try { - log.println("getCharacter(-1)"); + System.out.println("getCharacter(-1)"); oObj.getCharacter(-1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res = false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res = true; } try { - log.println("getCharacter(chCount)"); + System.out.println("getCharacter(chCount)"); oObj.getCharacter(chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("Checking of every character in the text..."); + System.out.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 + + System.out.println("At the position " + i + "was expected character: " + text.charAt(i)); - log.println("but was returned: " + ch); + System.out.println("but was returned: " + ch); break; } } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -243,38 +245,39 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacterAttributes() { boolean res = true; try { - log.println("getCharacterAttributes(-1)"); + System.out.println("getCharacterAttributes(-1)"); oObj.getCharacterAttributes(-1, new String[0]); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getCharacterAttributes(chCount)"); + System.out.println("getCharacterAttributes(chCount)"); oObj.getCharacterAttributes(chCount, new String[0]); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getCharacterAttributes(chCount-1)"); + System.out.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"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -293,41 +296,42 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacterBounds() { boolean res = true; try { - log.println("getCharacterBounds(-1)"); + System.out.println("getCharacterBounds(-1)"); oObj.getCharacterBounds(-1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getCharacterBounds(chCount)"); + System.out.println("getCharacterBounds(chCount)"); oObj.getCharacterBounds(chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if (chCount > 0) { - log.println("getCharacterBounds(chCount-1)"); + System.out.println("getCharacterBounds(chCount-1)"); chBounds = oObj.getCharacterBounds(chCount-1); res &= chBounds != null; - log.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " + + System.out.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " + chBounds.Width + ", " + chBounds.Height); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -340,10 +344,11 @@ public class _XAccessibleText { * 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. + * @return */ public boolean _getCharacterCount() { chCount = oObj.getCharacterCount(); - log.println("Character count:" + chCount); + System.out.println("Character count:" + chCount); boolean res = chCount == text.length(); return res; } @@ -358,21 +363,22 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterBounds()</code> </li> * </ul> + * @return */ public boolean _getIndexAtPoint() { boolean res = true; - log.println("getIndexAtPoint(-1, -1):"); + System.out.println("getIndexAtPoint(-1, -1):"); Point pt = new Point(-1, -1); int index = oObj.getIndexAtPoint(pt); - log.println(Integer.toString(index)); + System.out.println(Integer.toString(index)); res &= index == -1; if (chBounds != null) { pt = new Point(chBounds.X , chBounds.Y ); - log.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):"); + System.out.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):"); index = oObj.getIndexAtPoint(pt); - log.println(Integer.toString(index)); + System.out.println(Integer.toString(index)); res &= index == (chCount - 1); } @@ -386,40 +392,41 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectedText() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, 0)"); + System.out.println("setSelection(0, 0)"); oObj.setSelection(0, 0); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); String txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.length() == 0; - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.equals(text); if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.equals(text.substring(1, chCount - 1)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -434,31 +441,32 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectionStart() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); int start = oObj.getSelectionStart(); - log.println("getSelectionStart():" + start); + System.out.println("getSelectionStart():" + start); res &= start == 0; if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); start = oObj.getSelectionStart(); - log.println("getSelectionStart():" + start); + System.out.println("getSelectionStart():" + start); res &= start == 1; } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -473,31 +481,32 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectionEnd() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); int end = oObj.getSelectionEnd(); - log.println("getSelectionEnd():" + end); + System.out.println("getSelectionEnd():" + end); res &= end == chCount; if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); end = oObj.getSelectionEnd(); - log.println("getSelectionEnd():" + end); + System.out.println("getSelectionEnd():" + end); res &= end == chCount - 1; } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -513,67 +522,68 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _setSelection() { boolean res = true; boolean locRes = true; if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } try { - log.println("setSelection(-1, chCount-1):"); + System.out.println("setSelection(-1, chCount-1):"); locRes = oObj.setSelection(-1, chCount - 1); - log.println(locRes + " exception was expected"); + System.out.println(locRes + " exception was expected"); res &= !locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("setSelection(0, chCount+1):"); + System.out.println("setSelection(0, chCount+1):"); locRes = oObj.setSelection(0, chCount + 1); - log.println(locRes + " excepion was expected"); + System.out.println(locRes + " excepion was expected"); res &= !locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if (chCount > 2) { - log.println("setSelection(1, chCount-1):"); + System.out.println("setSelection(1, chCount-1):"); locRes = oObj.setSelection(1, chCount - 1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; - log.println("setSelection(chCount-1, 1):"); + System.out.println("setSelection(chCount-1, 1):"); locRes = oObj.setSelection(chCount - 1, 1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } if (chCount > 1) { - log.println("setSelection(0, chCount-1):"); + System.out.println("setSelection(0, chCount-1):"); locRes = oObj.setSelection(0, chCount-1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; - log.println("setSelection(chCount-1, 0):"); + System.out.println("setSelection(chCount-1, 0):"); locRes = oObj.setSelection(chCount-1, 0); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } - log.println("setSelection(0, 0):"); + System.out.println("setSelection(0, 0):"); locRes = oObj.setSelection(0, 0); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -585,10 +595,11 @@ public class _XAccessibleText { * Calls the method and checks returned value. * Has OK status if returned string is not null * received from relation. + * @return */ public boolean _getText() { text = oObj.getText(); - log.println("getText: '" + text + "'"); + System.out.println("getText: '" + text + "'"); return (text != null); } @@ -602,6 +613,7 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextRange() { boolean res = true; @@ -609,75 +621,75 @@ public class _XAccessibleText { try { if (chCount > 3) { - log.println("getTextRange(1, chCount - 2): "); + System.out.println("getTextRange(1, chCount - 2): "); String txtRange = oObj.getTextRange(1, chCount - 2); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(text.substring(1, chCount - 2)); res &= locRes; if (!locRes) { - log.println("Was expected: " + + System.out.println("Was expected: " + text.substring(1, chCount - 2)); } } if (chCount > 0) { - log.println("getTextRange(0, chCount-1): "); + System.out.println("getTextRange(0, chCount-1): "); String txtRange = oObj.getTextRange(0, chCount-1); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(text.substring(0, chCount - 1)); res &= locRes; if (!locRes) { - log.println("Was expected: " + + System.out.println("Was expected: " + text.substring(0, chCount - 1)); } - log.println("getTextRange(chCount, 0): "); + System.out.println("getTextRange(chCount, 0): "); txtRange = oObj.getTextRange(chCount, 0); - log.println(txtRange); + System.out.println(txtRange); res &= txtRange.equals(text); - log.println("getTextRange(0, 0): "); + System.out.println("getTextRange(0, 0): "); txtRange = oObj.getTextRange(0, 0); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(""); res &= locRes; if (!locRes) { - log.println("Empty string was expected"); + System.out.println("Empty string was expected"); } } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } try { - log.println("getTextRange(-1, chCount - 1): "); + System.out.println("getTextRange(-1, chCount - 1): "); String txtRange = oObj.getTextRange(-1, chCount - 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextRange(0, chCount + 1): "); + System.out.println("getTextRange(0, chCount + 1): "); String txtRange = oObj.getTextRange(0, chCount + 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextRange(chCount+1, -1): "); + System.out.println("getTextRange(chCount+1, -1): "); String txtRange = oObj.getTextRange(chCount+1, -1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } @@ -694,62 +706,63 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextAtIndex() { boolean res = true; try { - log.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextAtIndex(chCount+1," + + System.out.println("getTextAtIndex(chCount+1," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getTextAtIndex(chCount," + + System.out.println("getTextAtIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; - log.println("getTextAtIndex(1," + + System.out.println("getTextAtIndex(1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextAtIndex(1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -767,78 +780,79 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextBeforeIndex() { boolean res = true; try { - log.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextBeforeIndex(chCount+1, " + + System.out.println("getTextBeforeIndex(chCount+1, " + "AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBeforeIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } TextSegment txt = null; try { if (chCount > 0) { - log.println("getTextBeforeIndex(chCount," + + System.out.println("getTextBeforeIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBeforeIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == chCount ; - log.println("getTextBeforeIndex(1," + + System.out.println("getTextBeforeIndex(1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBeforeIndex(1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; } if (chCount > 2) { - log.println("getTextBeforeIndex(chCount-1," + + System.out.println("getTextBeforeIndex(chCount-1," + " AccessibleTextType.CHARACTER):"); txt = oObj.getTextBeforeIndex(chCount - 1, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(chCount - 2, chCount - 1)); - log.println("getTextBeforeIndex(2," + + System.out.println("getTextBeforeIndex(2," + " AccessibleTextType.CHARACTER):"); txt = oObj.getTextBeforeIndex(2, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(1, 2)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -856,79 +870,80 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextBehindIndex() { boolean res = true; try { - log.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextBehindIndex(chCount+1, " + + System.out.println("getTextBehindIndex(chCount+1, " + "AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getTextBehindIndex(chCount," + + System.out.println("getTextBehindIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; - log.println("getTextBehindIndex(chCount-1," + + System.out.println("getTextBehindIndex(chCount-1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBehindIndex(chCount - 1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; } if ( chCount > 1 ) { - log.println("getTextBehindIndex(1," + + System.out.println("getTextBehindIndex(1," + " AccessibleTextType.CHARACTER):"); TextSegment txt = oObj.getTextBehindIndex(1, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(2, 3)); } if (chCount > 2) { - log.println("getTextBehindIndex(chCount-2," + + System.out.println("getTextBehindIndex(chCount-2," + " AccessibleTextType.CHARACTER):"); TextSegment txt = oObj.getTextBehindIndex(chCount - 2, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -942,40 +957,41 @@ public class _XAccessibleText { * 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>. + * @return */ public boolean _copyText() { boolean res = true; boolean locRes = true; if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } try { - log.println("copyText(-1,chCount):"); + System.out.println("copyText(-1,chCount):"); oObj.copyText(-1, chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("copyText(0,chCount+1):"); + System.out.println("copyText(0,chCount+1):"); oObj.copyText(0, chCount + 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("copyText(0,chCount):"); + System.out.println("copyText(0,chCount):"); locRes = oObj.copyText(0, chCount); - log.println(""+locRes); + System.out.println(""+locRes); res &= locRes; String cbText = null; @@ -983,31 +999,31 @@ public class _XAccessibleText { cbText = util.SysUtils.getSysClipboardText(xMSF); } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't access system clipboard :"); + System.out.println("Couldn't access system clipboard :"); e.printStackTrace(); } - log.println("Clipboard: '" + cbText + "'"); + System.out.println("Clipboard: '" + cbText + "'"); res &= text.equals(cbText); if (chCount > 2) { - log.println("copyText(1,chCount-1):"); + System.out.println("copyText(1,chCount-1):"); locRes = oObj.copyText(1, chCount - 1); - log.println(""+locRes); + System.out.println(""+locRes); res &= locRes; try { cbText = util.SysUtils.getSysClipboardText(xMSF); } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't access system clipboard :"); + System.out.println("Couldn't access system clipboard :"); e.printStackTrace(); } - log.println("Clipboard: '" + cbText + "'"); + System.out.println("Clipboard: '" + cbText + "'"); res &= text.substring(1, chCount - 1).equals(cbText); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java index 472412e80aa6..21787a70a2de 100644 --- a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java +++ b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java @@ -28,11 +28,11 @@ package complex.toolkit.interface_tests; import com.sun.star.awt.XRequestCallback; -import lib.MultiMethodTest; +// import lib.MultiMethodTest; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import com.sun.star.uno.UnoRuntime; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.awt.XRequestCallback</code> @@ -44,7 +44,7 @@ import share.LogWriter; */ public class _XRequestCallback { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.awt.XRequestCallback" ; @@ -55,11 +55,10 @@ public class _XRequestCallback { String text = null; - public _XRequestCallback(XInterface object, LogWriter log, XMultiServiceFactory xMSF ) { - oObj = (XRequestCallback)UnoRuntime.queryInterface( - XRequestCallback.class, object); + public _XRequestCallback(XInterface object, XMultiServiceFactory xMSF ) { + oObj = UnoRuntime.queryInterface(XRequestCallback.class, object); this.xMSF = xMSF; - this.log = log; + // this.log = log; } @@ -70,6 +69,7 @@ public class _XRequestCallback { * <ul> * <li> <code>addCallback()</code> </li> * </ul> + * @return */ public boolean _addCallback() { @@ -80,7 +80,7 @@ public class _XRequestCallback { } catch (com.sun.star.uno.RuntimeException ie) { res = false; } - log.println("addCallback called" ); + System.out.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 index 0e324109f28d..7d8c4c951d4e 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk +++ b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/.. +PRJ = ../../../.. TARGET = Toolkit PRJNAME = $(TARGET) -PACKAGE = complex$/toolkit$/interface_tests +PACKAGE = complex/toolkit/interface_tests # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk @@ -36,14 +36,14 @@ PACKAGE = complex$/toolkit$/interface_tests #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = 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) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) # --- Targets ------------------------------------------------------ diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk index 3a4e096719bb..48386843a15f 100755 --- a/toolkit/qa/complex/toolkit/makefile.mk +++ b/toolkit/qa/complex/toolkit/makefile.mk @@ -25,58 +25,88 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = Toolkit -PRJNAME = $(TARGET) -PACKAGE = complex$/toolkit +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk +PRJ = ../../.. +PRJNAME = toolkit +TARGET = qa_complex_toolkit +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/toolkit -#----- compile .java files ----------------------------------------- +JAVATESTFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -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 +.END -# 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 +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: \ - CheckAccessibleStatusBarItem +ALLTAR : javatest -CheckAccessibleStatusBar: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBar +.END -CheckAccessibleStatusBarItem: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBarItem +# 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 +# diff --git a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java index 654f5ec69da5..f9840e4bde6f 100644 --- a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java +++ b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java @@ -29,13 +29,21 @@ package complex.xunitconversion; import com.sun.star.awt.XUnitConversion; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; + import com.sun.star.awt.XWindow; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.awt.XWindowPeer; import util.DesktopTools; +// import org.junit.After; +import org.junit.AfterClass; +// import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + /** * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods * These are converter methods to get the size of a well known awt component @@ -44,12 +52,12 @@ import util.DesktopTools; * * @author ll93751 */ -public class XUnitConversionTest extends ComplexTestCase +public class XUnitConversionTest { - public String[] getTestMethodNames() - { - return new String[]{"testXUnitConversion"}; // function name of the test method - } +// public String[] getTestMethodNames() +// { +// return new String[]{"testXUnitConversion"}; // function name of the test method +// } /** * returns the delta value between a and b @@ -77,14 +85,14 @@ public class XUnitConversionTest extends ComplexTestCase try { com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit); - log.println("Window size:"); - log.println("Width:" + aSizeIn.Width + " " + _sEinheit); - log.println("Height:" + aSizeIn.Height + " " + _sEinheit); - log.println(""); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeIn.Width + " " + _sEinheit); + System.out.println("Height:" + aSizeIn.Height + " " + _sEinheit); + System.out.println(""); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage()); + System.out.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage()); } } @@ -99,19 +107,22 @@ public class XUnitConversionTest extends ComplexTestCase * * If no test fails, the test is well done and returns with 'PASSED, OK' * - */ public void testXUnitConversion() + */ + @Test public void testXUnitConversion() { - XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF(); - assure("failed: There is no office.", xMSF != null); + // XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF(); + final XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + + assertNotNull("failed: There is no office.", xMSF); // create a window XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF); - assure("failed: there is no window peer", xWindowPeer != null); + assertNotNull("failed: there is no window peer", xWindowPeer); // resize and move the window to a well known position and size - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); - assure("failed: there is no window, cast wrong?", xWindow != null); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer); + assertNotNull("failed: there is no window, cast wrong?", xWindow); xWindow.setVisible(Boolean.TRUE); @@ -125,30 +136,30 @@ public class XUnitConversionTest extends ComplexTestCase com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y); com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height); - log.println("Window position and size in pixel:"); - log.println("X:" + aPoint.X); - log.println("Y:" + aPoint.Y); - log.println("Width:" + aSize.Width); - log.println("Height:" + aSize.Height); - log.println(""); + System.out.println("Window position and size in pixel:"); + System.out.println("X:" + aPoint.X); + System.out.println("Y:" + aPoint.Y); + System.out.println("Width:" + aSize.Width); + System.out.println("Height:" + aSize.Height); + System.out.println(""); - assure("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y); + assertTrue("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y); // XToolkit aToolkit = xWindowPeer.getToolkit(); - m_xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer); + m_xConversion = UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer); // try to get the position of the window in 1/100mm with the XUnitConversion method try { com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window position:"); - log.println("X:" + aPointInMM_100TH.X + " 1/100mm"); - log.println("Y:" + aPointInMM_100TH.Y + " 1/100mm"); - log.println(""); + System.out.println("Window position:"); + System.out.println("X:" + aPointInMM_100TH.X + " 1/100mm"); + System.out.println("Y:" + aPointInMM_100TH.Y + " 1/100mm"); + System.out.println(""); } catch (com.sun.star.lang.IllegalArgumentException e) { - assure("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage(), Boolean.FALSE); + fail("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage()); } // try to get the size of the window in 1/100mm with the XUnitConversion method @@ -157,22 +168,22 @@ public class XUnitConversionTest extends ComplexTestCase try { aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window size:"); - log.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm"); - log.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm"); - log.println(""); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm"); + System.out.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm"); + System.out.println(""); // try to get the size of the window in 1/10mm with the XUnitConversion method aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH); - log.println("Window size:"); - log.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm"); - log.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm"); - log.println(""); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm"); + System.out.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm"); + System.out.println(""); // check the size with a delta which must be smaller a given difference - assure("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10); - assure("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10); + assertTrue("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10); + assertTrue("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10); // new checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel"); @@ -196,27 +207,44 @@ public class XUnitConversionTest extends ComplexTestCase } catch (com.sun.star.lang.IllegalArgumentException e) { - assure("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage(), Boolean.FALSE); + fail("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage()); } // convert the 1/100mm window size back to pixel try { com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window size:"); - log.println("Width:" + aNewSize.Width + " pixel"); - log.println("Height:" + aNewSize.Height + " pixel"); + System.out.println("Window size:"); + System.out.println("Width:" + aNewSize.Width + " pixel"); + System.out.println("Height:" + aNewSize.Height + " pixel"); // assure the pixels are the same as we already know - assure("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height); + assertTrue("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height); } catch (com.sun.star.lang.IllegalArgumentException e) { - assure("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage(), Boolean.FALSE); + fail("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage()); } // close the window. // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface xWindow.dispose(); } + + + + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/toolkit/qa/complex/xunitconversion/makefile.mk b/toolkit/qa/complex/xunitconversion/makefile.mk index 18b59ee19f18..bc5a0e7c5949 100644 --- a/toolkit/qa/complex/xunitconversion/makefile.mk +++ b/toolkit/qa/complex/xunitconversion/makefile.mk @@ -25,53 +25,28 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = XUnitConversionTest -PRJNAME = $(TARGET) -PACKAGE = complex$/xunitconversion - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = XUnitConversionTest.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -SUBDIRS = - -#----- 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 = +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: .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\$/\.\) +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_xunitconversiontest -# start the runner application -CT_APP = org.openoffice.Runner +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/xunitconversion -# --- Targets ------------------------------------------------------ +JAVATESTFILES = \ + XUnitConversionTest.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END -.INCLUDE : target.mk +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: $(JAVAFILES) XUnitConversionTest +ALLTAR : javatest -XUnitConversionTest: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).XUnitConversionTest +.END |