From e87535433d01f4adef3fba640a6f116d6215054e Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Thu, 3 Jun 2010 13:21:58 +0200 Subject: sb123:#111449# change sc complex tests --- sc/prj/build.lst | 7 + sc/qa/complex/calcPreview/TestDocument.java | 39 ++ sc/qa/complex/calcPreview/ViewForwarder.java | 501 +++++++++++---------- sc/qa/complex/calcPreview/makefile.mk | 140 +++--- .../complex/cellRanges/CheckXCellRangesQuery.java | 157 +++++-- sc/qa/complex/cellRanges/makefile.mk | 62 +-- sc/qa/complex/dataPilot/CheckDataPilot.java | 190 +++++--- .../interfaceTests/beans/_XPropertySet.java | 162 +++---- .../dataPilot/interfaceTests/beans/makefile.mk | 6 +- .../interfaceTests/container/_XNamed.java | 44 +- .../dataPilot/interfaceTests/container/makefile.mk | 6 +- .../sheet/_XDataPilotDescriptor.java | 133 +++--- .../interfaceTests/sheet/_XDataPilotTable.java | 24 +- .../dataPilot/interfaceTests/sheet/makefile.mk | 6 +- sc/qa/complex/dataPilot/makefile.mk | 43 +- sc/qa/complex/sc/CalcRTL.java | 238 +++++----- sc/qa/complex/sc/makefile.mk | 44 +- 17 files changed, 1042 insertions(+), 760 deletions(-) create mode 100644 sc/qa/complex/calcPreview/TestDocument.java diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 115e92990f3c..4631dae8e3d4 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -48,3 +48,10 @@ sc sc\addin\datefunc nmake - all sc_addfu sc_add sc_sdi sc_inc NULL sc sc\addin\rot13 nmake - all sc_adrot sc_add sc_sdi sc_inc NULL sc sc\addin\util nmake - all sc_adutil sc_addfu sc_adrot sc_sdi sc_inc NULL sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_inc sc_vba NULL + +# remarked due to the fact, key press is need in this test. +# sc sc\qa\complex\calcPreview nmake - all qa_calcpreview NULL + +sc sc\qa\complex\cellRanges nmake - all qa_cellranges sc_util NULL +sc sc\qa\complex\dataPilot nmake - all qa_datapilot sc_util NULL +sc sc\qa\complex\sc nmake - all qa_sc sc_util NULL diff --git a/sc/qa/complex/calcPreview/TestDocument.java b/sc/qa/complex/calcPreview/TestDocument.java new file mode 100644 index 000000000000..294154999fe7 --- /dev/null +++ b/sc/qa/complex/calcPreview/TestDocument.java @@ -0,0 +1,39 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +package complex.calcPreview; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument { + public static String getUrl(String name) { + return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); + } + + private TestDocument() {} +} diff --git a/sc/qa/complex/calcPreview/ViewForwarder.java b/sc/qa/complex/calcPreview/ViewForwarder.java index 160dc1ebd20a..1065e94295a6 100755 --- a/sc/qa/complex/calcPreview/ViewForwarder.java +++ b/sc/qa/complex/calcPreview/ViewForwarder.java @@ -27,7 +27,7 @@ package complex.calcPreview; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import com.sun.star.awt.XWindow; import com.sun.star.container.XIndexAccess; @@ -35,13 +35,13 @@ import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; import com.sun.star.frame.XDispatchProvider; import com.sun.star.frame.XModel; -import com.sun.star.lang.XComponent; +// import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sheet.XSpreadsheet; -import com.sun.star.sheet.XSpreadsheetDocument; +// import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; import com.sun.star.table.XCell; -import com.sun.star.uno.Any; +// import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -59,7 +59,7 @@ import util.SOfficeFactory; import util.utils; import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; +// import com.sun.star.beans.XPropertySetInfo; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XComponent; import com.sun.star.sheet.XHeaderFooterContent; @@ -67,20 +67,30 @@ import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.style.XStyle; import com.sun.star.style.XStyleFamiliesSupplier; import com.sun.star.text.XText; -import com.sun.star.drawing.XDrawPageSupplier; -import com.sun.star.drawing.XDrawPage; -import com.sun.star.drawing.XShape; -import com.sun.star.drawing.XShapes; +// import com.sun.star.drawing.XDrawPageSupplier; +// import com.sun.star.drawing.XDrawPage; +// import com.sun.star.drawing.XShape; +// import com.sun.star.drawing.XShapes; + +// import com.sun.star.beans.Property; +// import com.sun.star.lang.XServiceInfo; -import com.sun.star.beans.Property; -import com.sun.star.lang.XServiceInfo; + + +// 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.*; /** * A complex test for the preview of Calc documents. This complex test * needs interaction from the user: documents have to be resized and moved. */ -public class ViewForwarder extends ComplexTestCase { +public class ViewForwarder { /** The MultiServiceFactory **/ private XMultiServiceFactory mXMSF = null; @@ -88,34 +98,40 @@ public class ViewForwarder extends ComplexTestCase { /** Get all test methods. * @return The test methods. */ - public String[] getTestMethodNames() { - return new String[]{"checkPositiveViewForwarder", - "checkNegativeViewForwarder", - "checkPreviewHeaderCells", - "checkPreviewShape" - }; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkPositiveViewForwarder", +// "checkNegativeViewForwarder", +// "checkPreviewHeaderCells", +// "checkPreviewShape" +// }; +// } /** * Get a MultiServiceFactory from the Office before the test. */ - public void before() { - mXMSF = (XMultiServiceFactory)param.getMSF(); + @Before public void before() + { + mXMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + // SOfficeFactory SOF = SOfficeFactory.getFactory(mXMSF); + + // param = new TestParameters(); + // param.put("ServiceFactory", xMsf); + // mXMSF = (XMultiServiceFactory)param.getMSF(); } /** Create a spreadsheet document, insert some text, header and footer. * Let the user resize the document and check the contents. */ - public void checkPositiveViewForwarder() { + @Test public void checkPositiveViewForwarder() { SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); XSpreadsheetDocument xSpreadsheetDoc = null; try { - log.println("Creating a spreadsheet document"); + System.out.println("Creating a spreadsheet document"); xSpreadsheetDoc = SOF.createCalcDoc(null); } catch (com.sun.star.uno.Exception e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -125,7 +141,7 @@ public class ViewForwarder extends ComplexTestCase { XCell xCell = null; try { XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; - XIndexAccess oIndexSheets = (XIndexAccess) + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); Object o = oIndexSheets.getByIndex(0); XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( @@ -138,23 +154,23 @@ public class ViewForwarder extends ComplexTestCase { xCell = oSheet.getCellByPosition(0, 2) ; xCell.setFormula("Cell 2"); } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } - XModel aModel = (XModel) + XModel aModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xController = aModel.getCurrentController(); // get page styles - XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier) + XStyleFamiliesSupplier StyleFam = UnoRuntime.queryInterface( XStyleFamiliesSupplier.class, xSpreadsheetDoc ); @@ -170,17 +186,17 @@ public class ViewForwarder extends ComplexTestCase { StdStyle = (XStyle)AnyConverter.toObject( new com.sun.star.uno.Type(XStyle.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.container.NoSuchElementException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } //get the property-set - final XPropertySet PropSet = (XPropertySet) + final XPropertySet PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); XHeaderFooterContent RPHFC = null; @@ -192,12 +208,12 @@ public class ViewForwarder extends ComplexTestCase { new com.sun.star.uno.Type(XHeaderFooterContent.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.UnknownPropertyException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -218,12 +234,12 @@ public class ViewForwarder extends ComplexTestCase { RPHFC = (XHeaderFooterContent)AnyConverter.toObject( new com.sun.star.uno.Type(XHeaderFooterContent.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.UnknownPropertyException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -239,9 +255,9 @@ public class ViewForwarder extends ComplexTestCase { // switching to 'Page Preview' mode try { - XDispatchProvider xDispProv = (XDispatchProvider) + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, mXMSF.createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an @@ -253,9 +269,11 @@ public class ViewForwarder extends ComplexTestCase { URL aURL = aParseURL[0]; XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); if(xDispatcher != null) + { xDispatcher.dispatch( aURL, null ); + } } catch (com.sun.star.uno.Exception e) { - failed("Couldn't change mode"); + fail("Couldn't change mode"); return; } @@ -263,7 +281,7 @@ public class ViewForwarder extends ComplexTestCase { Thread.sleep(500); } catch (InterruptedException ex) {} - log.println("Press any key after resizing "); + System.out.println("Press any key after resizing "); try{ byte[]b = new byte[16]; System.in.read(b); @@ -283,34 +301,34 @@ public class ViewForwarder extends ComplexTestCase { (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); oObj = parent.getAccessibleContext().getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - log.println("ImplementationName " + utils.getImplName(oObj)); + System.out.println("ImplementationName " + utils.getImplName(oObj)); - XAccessibleComponent accPC = (XAccessibleComponent) + XAccessibleComponent accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Parent-BoundsX= "+accPC.getBounds().X); - log.println("Parent-BoundsY= "+accPC.getBounds().Y); - log.println("Parent-BoundsWidth= "+accPC.getBounds().Width); - log.println("Parent-BoundsHeight= "+accPC.getBounds().Height); + System.out.println("Parent-BoundsX= "+accPC.getBounds().X); + System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); + System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); + System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); - XAccessibleComponent accPPC = (XAccessibleComponent) + XAccessibleComponent accPPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent.getAccessibleContext().getAccessibleParent()); - log.println("P-Parent-BoundsX= "+accPPC.getBounds().X); - log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); - log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); - log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); + System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); + System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); + System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); + System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); try { Thread.sleep(500); } catch (InterruptedException ex) {} - log.println("Press any key when the second line is on top"); + System.out.println("Press any key when the second line is on top"); try{ byte[]b = new byte[16]; System.in.read(b); @@ -319,46 +337,46 @@ public class ViewForwarder extends ComplexTestCase { } try { - log.println("ChildCount: "+ + System.out.println("ChildCount: "+ parent.getAccessibleContext().getAccessibleChildCount()); - log.println("Getting child 0 again"); + System.out.println("Getting child 0 again"); oObj = parent.getAccessibleContext().getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - XAccessibleText accT = (XAccessibleText) + XAccessibleText accT = UnoRuntime.queryInterface(XAccessibleText.class, oObj); - log.println("Getting the text: "+accT.getText()); + System.out.println("Getting the text: "+accT.getText()); - XAccessibleComponent accC = (XAccessibleComponent) + XAccessibleComponent accC = UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); - log.println("BoundsX= "+accC.getBounds().X); - log.println("BoundsY= "+accC.getBounds().Y); - log.println("BoundsWidth= "+accC.getBounds().Width); - log.println("BoundsHeight= "+accC.getBounds().Height); + System.out.println("BoundsX= "+accC.getBounds().X); + System.out.println("BoundsY= "+accC.getBounds().Y); + System.out.println("BoundsWidth= "+accC.getBounds().Width); + System.out.println("BoundsHeight= "+accC.getBounds().Height); - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Parent-BoundsX= "+accPC.getBounds().X); - log.println("Parent-BoundsY= "+accPC.getBounds().Y); - log.println("Parent-BoundsWidth= "+accPC.getBounds().Width); - log.println("Parent-BoundsHeight= "+accPC.getBounds().Height); + System.out.println("Parent-BoundsX= "+accPC.getBounds().X); + System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); + System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); + System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); - accPPC = (XAccessibleComponent) + accPPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent.getAccessibleContext().getAccessibleParent()); - log.println("P-Parent-BoundsX= "+accPPC.getBounds().X); - log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); - log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); - log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); + System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); + System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); + System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); + System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); - log.println("Press any key when the footer is visible."); + System.out.println("Press any key when the footer is visible."); try{ byte[]b = new byte[16]; System.in.read(b); @@ -370,53 +388,53 @@ public class ViewForwarder extends ComplexTestCase { parent = at.getAccessibleObjectForRole (xRoot, AccessibleRole.FOOTER, "").getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); try { - log.println("ChildCount: "+ + System.out.println("ChildCount: "+ parent.getAccessibleContext().getAccessibleChildCount()); - log.println("Getting child 0 again"); + System.out.println("Getting child 0 again"); oObj = parent.getAccessibleContext().getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - accT = (XAccessibleText) + accT = UnoRuntime.queryInterface(XAccessibleText.class, oObj); - log.println("Getting the text: "+accT.getText()); + System.out.println("Getting the text: "+accT.getText()); - accC = (XAccessibleComponent) + accC = UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); - log.println("BoundsX= "+accC.getBounds().X); - log.println("BoundsY= "+accC.getBounds().Y); - log.println("BoundsWidth= "+accC.getBounds().Width); - log.println("BoundsHeight= "+accC.getBounds().Height); + System.out.println("BoundsX= "+accC.getBounds().X); + System.out.println("BoundsY= "+accC.getBounds().Y); + System.out.println("BoundsWidth= "+accC.getBounds().Width); + System.out.println("BoundsHeight= "+accC.getBounds().Height); - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Parent-BoundsX= "+accPC.getBounds().X); - log.println("Parent-BoundsY= "+accPC.getBounds().Y); - log.println("Parent-BoundsWidth= "+accPC.getBounds().Width); - log.println("Parent-BoundsHeight= "+accPC.getBounds().Height); + System.out.println("Parent-BoundsX= "+accPC.getBounds().X); + System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); + System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); + System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); - accPPC = (XAccessibleComponent) + accPPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent.getAccessibleContext().getAccessibleParent()); - log.println("P-Parent-BoundsX= "+accPPC.getBounds().X); - log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); - log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); - log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); + System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); + System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); + System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); + System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); - log.println("Press any key when the page content is on top"); + System.out.println("Press any key when the page content is on top"); try{ byte[]b = new byte[16]; System.in.read(b); @@ -428,22 +446,22 @@ public class ViewForwarder extends ComplexTestCase { parent = at.getAccessibleObjectForRole (xRoot, AccessibleRole.DOCUMENT, "").getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } System.out.println("PARENT: " + parent.getAccessibleContext().getAccessibleName()); - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); int cCount = 0; try { cCount = parent.getAccessibleContext().getAccessibleChildCount(); - log.println("ChildCount: "+cCount); - log.println("Getting child 0 again"); + System.out.println("ChildCount: "+cCount); + System.out.println("Getting child 0 again"); oObj = parent.getAccessibleContext().getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } @@ -452,7 +470,7 @@ public class ViewForwarder extends ComplexTestCase { XAccessible xA = parent.getAccessibleContext().getAccessibleChild(i); System.out.println("NAME object " + i + ": " + xA.getAccessibleContext().getAccessibleName()); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } } @@ -460,43 +478,47 @@ public class ViewForwarder extends ComplexTestCase { System.out.println("SERVICES:"); util.dbg.getSuppServices(oObj); - XAccessibleValue accV = (XAccessibleValue) + XAccessibleValue accV = UnoRuntime.queryInterface(XAccessibleValue.class, oObj); Object o = accV.getCurrentValue(); if (o instanceof String) + { System.out.println("Value: " + (String)o); + } else + { System.out.println("Name of Object: " + o.getClass().getName()); - log.println("Getting the value: "+accV.getCurrentValue()); + } + System.out.println("Getting the value: "+accV.getCurrentValue()); - accC = (XAccessibleComponent) + accC = UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); - log.println("BoundsX= "+accC.getBounds().X); - log.println("BoundsY= "+accC.getBounds().Y); - log.println("BoundsWidth= "+accC.getBounds().Width); - log.println("BoundsHeight= "+accC.getBounds().Height); + System.out.println("BoundsX= "+accC.getBounds().X); + System.out.println("BoundsY= "+accC.getBounds().Y); + System.out.println("BoundsWidth= "+accC.getBounds().Width); + System.out.println("BoundsHeight= "+accC.getBounds().Height); - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Parent-BoundsX= "+accPC.getBounds().X); - log.println("Parent-BoundsY= "+accPC.getBounds().Y); - log.println("Parent-BoundsWidth= "+accPC.getBounds().Width); - log.println("Parent-BoundsHeight= "+accPC.getBounds().Height); + System.out.println("Parent-BoundsX= "+accPC.getBounds().X); + System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); + System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); + System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); - accPPC = (XAccessibleComponent) + accPPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent.getAccessibleContext().getAccessibleParent()); - log.println("P-Parent-BoundsX= "+accPPC.getBounds().X); - log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); - log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); - log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); + System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); + System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); + System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); + System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xSpreadsheetDoc); xComp.dispose(); } @@ -512,15 +534,15 @@ public class ViewForwarder extends ComplexTestCase { * Create a spreadsheet document, insert some text, header and footer. * Let the user resize the document and check the contents. */ - public void checkNegativeViewForwarder() { + @Test public void checkNegativeViewForwarder() { SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); XSpreadsheetDocument xSpreadsheetDoc = null; try { - log.println("Creating a spreadsheet document"); + System.out.println("Creating a spreadsheet document"); xSpreadsheetDoc = SOF.createCalcDoc(null); } catch (com.sun.star.uno.Exception e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -530,7 +552,7 @@ public class ViewForwarder extends ComplexTestCase { XCell xCell = null; try { XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; - XIndexAccess oIndexSheets = (XIndexAccess) + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); Object o = oIndexSheets.getByIndex(0); XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( @@ -543,23 +565,23 @@ public class ViewForwarder extends ComplexTestCase { xCell = oSheet.getCellByPosition(0, 2) ; xCell.setFormula("Cell 2"); } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception ceating relation :"); - failed(e.getMessage()); + System.out.println("Exception ceating relation :"); + fail(e.getMessage()); } - XModel aModel = (XModel) + XModel aModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xController = aModel.getCurrentController(); // get page styles - XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier) + XStyleFamiliesSupplier StyleFam = UnoRuntime.queryInterface( XStyleFamiliesSupplier.class, xSpreadsheetDoc ); @@ -575,34 +597,34 @@ public class ViewForwarder extends ComplexTestCase { StdStyle = (XStyle)AnyConverter.toObject( new com.sun.star.uno.Type(XStyle.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.container.NoSuchElementException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } //get the property-set - final XPropertySet PropSet = (XPropertySet) + final XPropertySet PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); XHeaderFooterContent RPHFC = null; // get the header - log.println( "Creating a test environment" ); + System.out.println( "Creating a test environment" ); try { Object o = PropSet.getPropertyValue("RightPageHeaderContent"); RPHFC = (XHeaderFooterContent)AnyConverter.toObject( new com.sun.star.uno.Type(XHeaderFooterContent.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.UnknownPropertyException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -623,12 +645,12 @@ public class ViewForwarder extends ComplexTestCase { RPHFC = (XHeaderFooterContent)AnyConverter.toObject( new com.sun.star.uno.Type(XHeaderFooterContent.class), o); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch(com.sun.star.lang.WrappedTargetException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.UnknownPropertyException e){ - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -644,9 +666,9 @@ public class ViewForwarder extends ComplexTestCase { // switching to 'Page Preview' mode try { - XDispatchProvider xDispProv = (XDispatchProvider) + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, mXMSF.createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an @@ -658,9 +680,11 @@ public class ViewForwarder extends ComplexTestCase { URL aURL = aParseURL[0]; XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); if(xDispatcher != null) + { xDispatcher.dispatch( aURL, null ); + } } catch (com.sun.star.uno.Exception e) { - failed("Couldn't change mode"); + fail("Couldn't change mode"); return; } @@ -668,7 +692,7 @@ public class ViewForwarder extends ComplexTestCase { Thread.sleep(500); } catch (InterruptedException ex) {} - log.println("Press any key after resizing "); + System.out.println("Press any key after resizing "); try{ byte[]b = new byte[16]; System.in.read(b); @@ -688,34 +712,34 @@ public class ViewForwarder extends ComplexTestCase { (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); oObj = parent.getAccessibleContext().getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - log.println("ImplementationName " + utils.getImplName(oObj)); + System.out.println("ImplementationName " + utils.getImplName(oObj)); - XAccessibleComponent accPC = (XAccessibleComponent) + XAccessibleComponent accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Parent-BoundsX= "+accPC.getBounds().X); - log.println("Parent-BoundsY= "+accPC.getBounds().Y); - log.println("Parent-BoundsWidth= "+accPC.getBounds().Width); - log.println("Parent-BoundsHeight= "+accPC.getBounds().Height); + System.out.println("Parent-BoundsX= "+accPC.getBounds().X); + System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); + System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); + System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); - XAccessibleComponent accPPC = (XAccessibleComponent) + XAccessibleComponent accPPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent.getAccessibleContext().getAccessibleParent()); - log.println("P-Parent-BoundsX= "+accPPC.getBounds().X); - log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); - log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); - log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); + System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); + System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); + System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); + System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); try { Thread.sleep(500); } catch (InterruptedException ex) {} - log.println("Press any key when the header is not visible."); + System.out.println("Press any key when the header is not visible."); try{ byte[]b = new byte[16]; System.in.read(b); @@ -726,24 +750,26 @@ public class ViewForwarder extends ComplexTestCase { int childCount = 0; childCount = parent.getAccessibleContext().getAccessibleChildCount(); - log.println("ChildCount: "+childCount); + System.out.println("ChildCount: "+childCount); if (childCount != 0) - failed("Could access header although it was not visible on page."); + { + fail("Could access header although it was not visible on page."); + } try { parent = at.getAccessibleObjectForRole (xRoot, AccessibleRole.FOOTER, "").getAccessibleChild(0); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } - accPC = (XAccessibleComponent) + accPC = UnoRuntime.queryInterface(XAccessibleComponent.class, parent); - log.println("Press any key when the footer is not visible."); + System.out.println("Press any key when the footer is not visible."); try{ byte[]b = new byte[16]; System.in.read(b); @@ -753,12 +779,14 @@ public class ViewForwarder extends ComplexTestCase { childCount = parent.getAccessibleContext().getAccessibleChildCount(); - log.println("ChildCount: "+childCount); + System.out.println("ChildCount: "+childCount); if (childCount != 0) - failed("Could access footer although it was not visible on page."); + { + fail("Could access footer although it was not visible on page."); + } - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp =UnoRuntime.queryInterface( XComponent.class, xSpreadsheetDoc); xComp.dispose(); @@ -770,21 +798,21 @@ public class ViewForwarder extends ComplexTestCase { /** * Check the preview of header cells */ - public void checkPreviewHeaderCells() { + @Test public void checkPreviewHeaderCells() { XInterface oObj = null; SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF); XSpreadsheetDocument xSpreadsheetDoc = null; try { - log.println("Creating a spreadsheet document"); + System.out.println("Creating a spreadsheet document"); xSpreadsheetDoc = SOF.createCalcDoc(null); } catch (com.sun.star.uno.Exception e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } - XModel xModel = (XModel) + XModel xModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xController = xModel.getCurrentController(); @@ -792,70 +820,70 @@ public class ViewForwarder extends ComplexTestCase { //setting value of cell A1 XCell xCell = null; try { - log.println("Getting spreadsheet") ; + System.out.println("Getting spreadsheet") ; XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; - XIndexAccess oIndexSheets = (XIndexAccess) + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); Object o = oIndexSheets.getByIndex(0); XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( new com.sun.star.uno.Type(XSpreadsheet.class), o); - log.println("Getting a cell from sheet") ; + System.out.println("Getting a cell from sheet") ; xCell = oSheet.getCellByPosition(0, 0); } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); } catch (com.sun.star.lang.WrappedTargetException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } xCell.setFormula("Value"); //setting property 'PrintHeaders' of the style 'Default' - XStyleFamiliesSupplier xSFS = (XStyleFamiliesSupplier) + XStyleFamiliesSupplier xSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xSpreadsheetDoc); XNameAccess xNA = xSFS.getStyleFamilies(); XPropertySet xPropSet = null; try { Object oPageStyles = xNA.getByName("PageStyles"); - xNA = (XNameAccess) + xNA = UnoRuntime.queryInterface(XNameAccess.class, oPageStyles); Object oDefStyle = xNA.getByName("Default"); - xPropSet = (XPropertySet) + xPropSet = UnoRuntime.queryInterface(XPropertySet.class, oDefStyle); } catch(com.sun.star.lang.WrappedTargetException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.container.NoSuchElementException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } try { xPropSet.setPropertyValue("PrintHeaders", new Boolean(true)); } catch(com.sun.star.lang.WrappedTargetException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.lang.IllegalArgumentException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.PropertyVetoException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } catch(com.sun.star.beans.UnknownPropertyException e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } //switching to 'Print Preview' mode try { - XDispatchProvider xDispProv = (XDispatchProvider) + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, mXMSF.createInstance("com.sun.star.util.URLTransformer")); URL[] aParseURL = new URL[1]; @@ -865,9 +893,11 @@ public class ViewForwarder extends ComplexTestCase { URL aURL = aParseURL[0]; XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); if(xDispatcher != null) + { xDispatcher.dispatch( aURL, null ); + } } catch (com.sun.star.uno.Exception e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } @@ -882,9 +912,9 @@ public class ViewForwarder extends ComplexTestCase { XWindow xWindow = at.getCurrentWindow(mXMSF, xModel); XAccessible xRoot = at.getAccessibleObject(xWindow); -// log.println("ImplementationName " + utils.getImplName(oObj)); +// System.out.println("ImplementationName " + utils.getImplName(oObj)); - log.println("Press any key when the header cell is on top."); + System.out.println("Press any key when the header cell is on top."); try{ byte[]b = new byte[16]; System.in.read(b); @@ -905,7 +935,7 @@ public class ViewForwarder extends ComplexTestCase { oObj = at.getAccessibleObjectForRole (xRoot, AccessibleRole.TABLE, "").getAccessibleChild(2); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } @@ -921,26 +951,26 @@ public class ViewForwarder extends ComplexTestCase { try { System.out.println("Children now: " + accCtx.getAccessibleChild(0).getAccessibleContext().getAccessibleChildCount()); } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - failed(iabe.getMessage()); + fail(iabe.getMessage()); return; } */ - XAccessibleValue accV = (XAccessibleValue) + XAccessibleValue accV = UnoRuntime.queryInterface(XAccessibleValue.class, oObj); Object o = accV.getCurrentValue(); - log.println("Getting the value: "+o + " is void " + util.utils.isVoid(o)); + System.out.println("Getting the value: "+o + " is void " + util.utils.isVoid(o)); - XAccessibleComponent accC = (XAccessibleComponent) + XAccessibleComponent accC = UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); - log.println("BoundsX= "+accC.getBounds().X); - log.println("BoundsY= "+accC.getBounds().Y); - log.println("BoundsWidth= "+accC.getBounds().Width); - log.println("BoundsHeight= "+accC.getBounds().Height); + System.out.println("BoundsX= "+accC.getBounds().X); + System.out.println("BoundsY= "+accC.getBounds().Y); + System.out.println("BoundsWidth= "+accC.getBounds().Width); + System.out.println("BoundsHeight= "+accC.getBounds().Height); - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xSpreadsheetDoc); xComp.dispose(); @@ -954,7 +984,7 @@ public class ViewForwarder extends ComplexTestCase { * Check the preview of Shapes: load a document with shapes and see, if they * are accessible. */ - public void checkPreviewShape() { + @Test public void checkPreviewShape() { SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); XSpreadsheetDocument xSpreadsheetDoc = null; XComponent xComp = null; @@ -962,14 +992,15 @@ public class ViewForwarder extends ComplexTestCase { try { String docName = "calcshapes.sxc"; - log.println("Loading a spreadsheetdocument."); - String url = utils.getFullURL( - (String)param.get("TestDocumentPath") + "/" + docName); - log.println("loading document '" + url + "'"); + System.out.println("Loading a spreadsheetdocument."); + // String url = utils.getFullURL((String)param.get("TestDocumentPath") + "/" + docName); + String url = TestDocument.getUrl(docName); + System.out.println("loading document '" + url + "'"); xComp = SOF.loadDocument(url); - - } catch (com.sun.star.uno.Exception e) { - failed(e.getMessage()); + assertNotNull(xComp); + } + catch (com.sun.star.uno.Exception e) { + fail(e.getMessage()); return; } @@ -980,22 +1011,22 @@ public class ViewForwarder extends ComplexTestCase { } if (xComp == null) { - failed("loading document failed."); + fail("loading document failed."); return; } - xSpreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( + xSpreadsheetDoc = UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComp); - XModel aModel = (XModel) + XModel aModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xController = aModel.getCurrentController(); // switching to 'Page Preview' mode try { - XDispatchProvider xDispProv = (XDispatchProvider) + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, mXMSF.createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an @@ -1007,9 +1038,11 @@ public class ViewForwarder extends ComplexTestCase { URL aURL = aParseURL[0]; XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); if(xDispatcher != null) + { xDispatcher.dispatch( aURL, null ); + } } catch (com.sun.star.uno.Exception e) { - failed("Couldn't change mode"); + fail("Couldn't change mode"); return; } @@ -1021,7 +1054,7 @@ public class ViewForwarder extends ComplexTestCase { - log.println("Press any key when a shape is on top."); + System.out.println("Press any key when a shape is on top."); try{ byte[]b = new byte[16]; System.in.read(b); @@ -1039,19 +1072,31 @@ public class ViewForwarder extends ComplexTestCase { try { XAccessibleContext con = at.getAccessibleObjectForRole (xRoot, AccessibleRole.SHAPE, ""); - log.println("Name of AccessibleContext: " + con.getAccessibleName()); + System.out.println("Name of AccessibleContext: " + con.getAccessibleName()); oObj = con; } catch (Exception e) { - failed(e.getMessage()); + fail(e.getMessage()); return; } - log.println("ImplementationName: " + utils.getImplName(oObj)); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); util.dbg.printInterfaces(oObj); xComp.dispose(); } + @BeforeClass public static void setUpConnection() throws Exception { + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/sc/qa/complex/calcPreview/makefile.mk b/sc/qa/complex/calcPreview/makefile.mk index 14f9428678e7..864e14976964 100755 --- a/sc/qa/complex/calcPreview/makefile.mk +++ b/sc/qa/complex/calcPreview/makefile.mk @@ -25,69 +25,99 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = ViewForward -PRJNAME = $(TARGET) -PACKAGE = complex$/calcPreview - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar -JAVAFILES = ViewForwarder.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- 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 = -TestBase java_complex +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_calcpreview -# set test document path -CT_TESTDOCS = -tdoc $(PWD)$/test_documents +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/calcPreview +JAVATESTFILES = \ + TestDocument.java \ + ViewForwarder.java -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END -# start the runner application -CT_APP = org.openoffice.Runner - -# set the timeout to a bigger value -CT_TIMEOUT = -TimeOut 120000 - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -$(CLASSDIR)$/$(PACKAGE)$/$(JAVAFILES:b).props : ALLTAR -.ELSE -$(CLASSDIR)$/$(PACKAGE)$/$(JAVAFILES:b).props : ALLDEP -.ENDIF +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -.INCLUDE : target.mk +ALLTAR : javatest +.END -RUN: - +java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTDOCS) $(CT_TESTBASE) $(CT_WORKDIR) $(CT_TIMEOUT) $(CT_TEST) -run: RUN -tst: - +@echo $(CT_TESTDOCS) +# PRJ = ..$/..$/.. +# TARGET = ViewForward +# PRJNAME = $(TARGET) +# PACKAGE = complex$/calcPreview +# +# # --- Settings ----------------------------------------------------- +# .INCLUDE: settings.mk +# +# +# #----- compile .java files ----------------------------------------- +# +# JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar +# JAVAFILES = ViewForwarder.java +# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +# +# #----- 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 = -TestBase java_complex +# +# # set test document path +# CT_TESTDOCS = -tdoc $(PWD)$/test_documents +# +# # test looks something like the.full.package.TestName +# CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +# +# # start the runner application +# CT_APP = org.openoffice.Runner +# +# # set the timeout to a bigger value +# CT_TIMEOUT = -TimeOut 120000 +# +# # --- Targets ------------------------------------------------------ +# +# .IF "$(depend)" == "" +# $(CLASSDIR)$/$(PACKAGE)$/$(JAVAFILES:b).props : ALLTAR +# .ELSE +# $(CLASSDIR)$/$(PACKAGE)$/$(JAVAFILES:b).props : ALLDEP +# .ENDIF +# +# .INCLUDE : target.mk +# +# +# RUN: +# +java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTDOCS) $(CT_TESTBASE) $(CT_WORKDIR) $(CT_TIMEOUT) $(CT_TEST) +# +# run: RUN +# +# tst: +# +@echo $(CT_TESTDOCS) +# diff --git a/sc/qa/complex/cellRanges/CheckXCellRangesQuery.java b/sc/qa/complex/cellRanges/CheckXCellRangesQuery.java index b23abe2d6a57..a85cb0483c1c 100755 --- a/sc/qa/complex/cellRanges/CheckXCellRangesQuery.java +++ b/sc/qa/complex/cellRanges/CheckXCellRangesQuery.java @@ -28,30 +28,39 @@ package complex.cellRanges; import com.sun.star.container.XIndexAccess; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sheet.CellFlags; +// import com.sun.star.sheet.CellFlags; import com.sun.star.sheet.XCellRangesQuery; import com.sun.star.sheet.XSheetCellRanges; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; import com.sun.star.table.CellAddress; -import com.sun.star.table.XColumnRowRange; -import com.sun.star.table.XTableColumns; -import com.sun.star.table.XTableRows; +// import com.sun.star.table.XColumnRowRange; +// import com.sun.star.table.XTableColumns; +// import com.sun.star.table.XTableRows; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; -import java.io.PrintWriter; +// import java.io.PrintWriter; +import com.sun.star.util.XCloseable; import util.SOfficeFactory; +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.*; + /** * Check the XCellRangesQuery interface on the SheetCell service. test was * created for bug i20044. */ -public class CheckXCellRangesQuery extends ComplexTestCase { +public class CheckXCellRangesQuery /* extends ComplexTestCase */ { XSpreadsheetDocument m_xSheetDoc = null; XCellRangesQuery m_xCell = null; XSpreadsheet m_xSpreadSheet = null; @@ -60,50 +69,52 @@ public class CheckXCellRangesQuery extends ComplexTestCase { * Get all test methods. * @return The test methods. */ - public String[] getTestMethodNames() { - return new String[] {"checkEmptyCell", "checkFilledCell"}; - } +// public String[] getTestMethodNames() { +// return new String[] {"checkEmptyCell", "checkFilledCell"}; +// } /** * Creates Spreadsheet document and the test object, * before the actual test starts. */ - public void before() { + @Before public void before() { // create a calc document - SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)param.getMSF() ); + // SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)param.getMSF() ); + final XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + SOfficeFactory SOF = SOfficeFactory.getFactory(xMsf); try { - log.println( "creating a Spreadsheet document" ); + System.out.println( "creating a Spreadsheet document" ); m_xSheetDoc = SOF.createCalcDoc(null); } catch ( com.sun.star.uno.Exception e ) { // Some exception occures.FAILED - e.printStackTrace( (PrintWriter)log ); - failed( "Couldn?t create document"); + e.printStackTrace( ); + fail( "Couldn?t create document"); } XInterface oObj = null; try { - log.println("Getting spreadsheet") ; + System.out.println("Getting spreadsheet") ; XSpreadsheets oSheets = m_xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = (XIndexAccess) + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); m_xSpreadSheet = (XSpreadsheet) AnyConverter.toObject( new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); // get the cell - log.println("Getting a cell from sheet") ; + System.out.println("Getting a cell from sheet") ; oObj = m_xSpreadSheet.getCellByPosition(2, 3); - m_xCell = (XCellRangesQuery)UnoRuntime.queryInterface(XCellRangesQuery.class, oObj); + m_xCell = UnoRuntime.queryInterface(XCellRangesQuery.class, oObj); } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((PrintWriter)log); - failed("Error getting cell object from spreadsheet document"); + e.printStackTrace(); + fail("Error getting cell object from spreadsheet document"); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((PrintWriter)log); - failed("Error getting cell object from spreadsheet document"); + e.printStackTrace(); + fail("Error getting cell object from spreadsheet document"); } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((PrintWriter)log); - failed("Error getting cell object from spreadsheet document"); + e.printStackTrace(); + fail("Error getting cell object from spreadsheet document"); } // set one value for comparison. @@ -115,12 +126,45 @@ public class CheckXCellRangesQuery extends ComplexTestCase { m_xSpreadSheet.getCellByPosition(3, 2).setFormula(""); m_xSpreadSheet.getCellByPosition(3, 3).setFormula(""); */ } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((PrintWriter)log); - failed("Could not fill cell (1, 1) with a value."); + e.printStackTrace(); + fail("Could not fill cell (1, 1) with a value."); } } + /* + * this method closes a calc document and resets the corresponding class variable xSheetDoc + */ + protected boolean closeSpreadsheetDocument() { + boolean worked = true; + + System.out.println(" disposing xSheetDoc "); + + try { + XCloseable oCloser = UnoRuntime.queryInterface( + XCloseable.class, m_xSheetDoc); + oCloser.close(true); + } catch (com.sun.star.util.CloseVetoException e) { + worked = false; + System.out.println("Couldn't close document"); + } catch (com.sun.star.lang.DisposedException e) { + worked = false; + System.out.println("Document already disposed"); + } catch (java.lang.NullPointerException e) { + worked = false; + System.out.println("Couldn't get XCloseable"); + } + + m_xSheetDoc = null; + + return worked; + } + + @After public void after() + { + closeSpreadsheetDocument(); + } + /** * Perform some tests on an empty cell: *
    @@ -129,15 +173,15 @@ public class CheckXCellRangesQuery extends ComplexTestCase { *
  1. query for empty cells
  2. *
      */ - public void checkEmptyCell() { - log.println("Checking an empty cell..."); + @Test public void checkEmptyCell() { + System.out.println("Checking an empty cell..."); // compare an empty cell with a cell with a value - assure("\tQuery column differences did not return the correct value.", _queryColumnDifferences("Sheet1.C4"), true); + assertTrue("\tQuery column differences did not return the correct value.", _queryColumnDifferences("Sheet1.C4")); // compare an empty cell with a cell with a value - assure("\tQuery column differences did not return the correct value.", _queryRowDifferences("Sheet1.C4"), true); + assertTrue("\tQuery column differences did not return the correct value.", _queryRowDifferences("Sheet1.C4")); // try to get this cell - assure("\tQuery empty cells did not return the correct value.", _queryEmptyCells("Sheet1.C4"), true); - log.println("...done"); +// assertTrue("\tQuery empty cells did not return the correct value.", _queryEmptyCells("Sheet1.C4")); + System.out.println("...done"); } /** @@ -148,24 +192,24 @@ public class CheckXCellRangesQuery extends ComplexTestCase { *
    1. query for an empty cell.
    2. *
        */ - public void checkFilledCell() { - log.println("Checking a filled cell..."); + @Test public void checkFilledCell() { + System.out.println("Checking a filled cell..."); // fill the cell with a value try { m_xSpreadSheet.getCellByPosition(2, 3).setValue(15); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((PrintWriter)log); - failed("Could not fill cell (2, 3) with a value."); + e.printStackTrace(); + fail("Could not fill cell (2, 3) with a value."); } // compare an cell with value 5 with a cell with value 15 - assure("\tQuery column differences did not return the correct value.", _queryColumnDifferences("Sheet1.C4"), true); + assertTrue("\tQuery column differences did not return the correct value.", _queryColumnDifferences("Sheet1.C4")); // compare an cell with value 5 with a cell with value 15 - assure("\tQuery column differences did not return the correct value.", _queryRowDifferences("Sheet1.C4"), true); + assertTrue("\tQuery column differences did not return the correct value.", _queryRowDifferences("Sheet1.C4")); // try to get nothing - assure("\tQuery empty cells did not return the correct value.", _queryEmptyCells(""), true); - log.println("...done"); + assertTrue("\tQuery empty cells did not return the correct value.", _queryEmptyCells("")); + System.out.println("...done"); } @@ -175,14 +219,14 @@ public class CheckXCellRangesQuery extends ComplexTestCase { * @return True, if the result equals the expected result. */ public boolean _queryColumnDifferences(String expected) { - log.println("\tQuery column differences"); + System.out.println("\tQuery column differences"); XSheetCellRanges ranges = m_xCell.queryColumnDifferences( new CellAddress((short) 0, 1, 1)); String getting = ranges.getRangeAddressesAsString(); if (!getting.equals(expected)) { - log.println("\tGetting: " + getting); - log.println("\tShould have been: " + expected); + System.out.println("\tGetting: " + getting); + System.out.println("\tShould have been: " + expected); return false; } return true; @@ -194,13 +238,13 @@ public class CheckXCellRangesQuery extends ComplexTestCase { * @return True, if the result equals the expected result. */ public boolean _queryEmptyCells(String expected) { - log.println("\tQuery empty cells"); + System.out.println("\tQuery empty cells"); XSheetCellRanges ranges = m_xCell.queryEmptyCells(); String getting = ranges.getRangeAddressesAsString(); if (!getting.equals(expected)) { - log.println("\tGetting: " + getting); - log.println("\tShould have been: " + expected); + System.out.println("\tGetting: " + getting); + System.out.println("\tShould have been: " + expected); return false; } return true; @@ -212,18 +256,31 @@ public class CheckXCellRangesQuery extends ComplexTestCase { * @return True, if the result equals the expected result. */ public boolean _queryRowDifferences(String expected) { - log.println("\tQuery row differences"); + System.out.println("\tQuery row differences"); XSheetCellRanges ranges = m_xCell.queryRowDifferences( new CellAddress((short) 0, 1, 1)); String getting = ranges.getRangeAddressesAsString(); if (!getting.equals(expected)) { - log.println("\tGetting: " + getting); - log.println("\tShould have been: " + expected); + System.out.println("\tGetting: " + getting); + System.out.println("\tShould have been: " + expected); return false; } return true; } + + @BeforeClass public static void setUpConnection() throws Exception { + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/sc/qa/complex/cellRanges/makefile.mk b/sc/qa/complex/cellRanges/makefile.mk index fc296fe4f605..a0beb3839924 100755 --- a/sc/qa/complex/cellRanges/makefile.mk +++ b/sc/qa/complex/cellRanges/makefile.mk @@ -25,53 +25,27 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = CheckXCellRangesQuery -PRJNAME = $(TARGET) -PACKAGE = complex$/cellRanges - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = $(TARGET).java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- 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 = -TestBase java_complex -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_cellRanges -# start the runner application -CT_APP = org.openoffice.Runner +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/cellRanges +JAVATESTFILES = \ + CheckXCellRangesQuery.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -RUN: run +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: - +java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST) +ALLTAR : javatest +.END diff --git a/sc/qa/complex/dataPilot/CheckDataPilot.java b/sc/qa/complex/dataPilot/CheckDataPilot.java index d013daa24e1f..5fae88450c04 100644 --- a/sc/qa/complex/dataPilot/CheckDataPilot.java +++ b/sc/qa/complex/dataPilot/CheckDataPilot.java @@ -31,12 +31,12 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNamed; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sheet.TableFilterField; +// import com.sun.star.sheet.TableFilterField; import com.sun.star.sheet.XDataPilotDescriptor; import com.sun.star.sheet.XDataPilotTable; import com.sun.star.sheet.XDataPilotTables; import com.sun.star.sheet.XDataPilotTablesSupplier; -import com.sun.star.sheet.XSheetFilterDescriptor; +// import com.sun.star.sheet.XSheetFilterDescriptor; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; @@ -46,29 +46,47 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloseable; import complex.dataPilot.interfaceTests.beans._XPropertySet; import complex.dataPilot.interfaceTests.container._XNamed; import complex.dataPilot.interfaceTests.sheet._XDataPilotDescriptor; import complex.dataPilot.interfaceTests.sheet._XDataPilotTable; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import lib.StatusException; +import lib.TestParameters; import util.SOfficeFactory; +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.*; + + /** * check the DataPilot of Calc. */ -public class CheckDataPilot extends ComplexTestCase { +public class CheckDataPilot { /** The data pilot field object **/ private XInterface mDataPilotFieldObject = null; /** The data pilot table object **/ private XInterface mDataPilotTableObject = null; + + private XSpreadsheetDocument xSheetDoc = null; + /** * A field is filled some values. This integer determines the size of the * field in x and y direction. */ private int mMaxFieldIndex = 6; + /** + * The test parameters + */ + private static TestParameters param = null; /** * Get all test methods @@ -83,27 +101,27 @@ public class CheckDataPilot extends ComplexTestCase { * Test the data pilot field object: * simply execute the interface tests in a row */ - public void testDataPilotFieldObject() { - log.println("Starting 'testDataPilotFieldObject'"); + @Test public void testDataPilotFieldObject() { + System.out.println("Starting 'testDataPilotFieldObject'"); // _XNamed - XNamed xNamed = (XNamed)UnoRuntime.queryInterface( + XNamed xNamed = UnoRuntime.queryInterface( XNamed.class, mDataPilotFieldObject); - _XNamed _xNamed = new _XNamed(xNamed, log, param); - assure("_getName failed.",_xNamed._getName()); - assure("_setName failed.",_xNamed._setName()); + _XNamed _xNamed = new _XNamed(xNamed/*, log*/, param); + assertTrue("_getName failed.",_xNamed._getName()); + assertTrue("_setName failed.",_xNamed._setName()); // _XPropertySet - XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xProp = UnoRuntime.queryInterface( XPropertySet.class, mDataPilotFieldObject); - _XPropertySet _xProp = new _XPropertySet(xProp, log, param); - assure("_getPropertySetInfo failed.",_xProp._getPropertySetInfo()); - assure("_addPropertyChangeListener failed.",_xProp._addPropertyChangeListener()); - assure("_addVetoableChangeListener failed.",_xProp._addVetoableChangeListener()); - assure("_setPropertyValue failed.",_xProp._setPropertyValue()); - assure("_getPropertyValue failed.",_xProp._getPropertyValue()); - assure("_removePropertyChangeListener failed.",_xProp._removePropertyChangeListener()); - assure("_removeVetoableChangeListener failed.",_xProp._removeVetoableChangeListener()); + _XPropertySet _xProp = new _XPropertySet(xProp/*, log*/, param); + assertTrue("_getPropertySetInfo failed.",_xProp._getPropertySetInfo()); + assertTrue("_addPropertyChangeListener failed.",_xProp._addPropertyChangeListener()); + assertTrue("_addVetoableChangeListener failed.",_xProp._addVetoableChangeListener()); + assertTrue("_setPropertyValue failed.",_xProp._setPropertyValue()); + assertTrue("_getPropertyValue failed.",_xProp._getPropertyValue()); + assertTrue("_removePropertyChangeListener failed.",_xProp._removePropertyChangeListener()); + assertTrue("_removeVetoableChangeListener failed.",_xProp._removeVetoableChangeListener()); } @@ -111,53 +129,57 @@ public class CheckDataPilot extends ComplexTestCase { * Test the data pilot table object: * simply execute the interface tests in a row */ - public void testDataPilotTableObject() { - log.println("Starting 'testDataPilotTableObject'"); + @Test public void testDataPilotTableObject() { + System.out.println("Starting 'testDataPilotTableObject'"); // _XNamed - XNamed xNamed = (XNamed)UnoRuntime.queryInterface( + XNamed xNamed = UnoRuntime.queryInterface( XNamed.class, mDataPilotTableObject); - _XNamed _xNamed = new _XNamed(xNamed, log, param); - assure("_getName failed.",_xNamed._getName()); - assure("_setName failed.",_xNamed._setName()); + _XNamed _xNamed = new _XNamed(xNamed/*, log*/, param); + assertTrue("_getName failed.",_xNamed._getName()); + assertTrue("_setName failed.",_xNamed._setName()); // _XDataPilotTable - XDataPilotTable xDataPilotTable = (XDataPilotTable) + XDataPilotTable xDataPilotTable = UnoRuntime.queryInterface(XDataPilotTable.class, mDataPilotTableObject); _XDataPilotTable _xDataPilotTable = - new _XDataPilotTable(xDataPilotTable, log, param); - assure("before failed.", _xDataPilotTable.before()); - assure("_getOutputRange failed.", _xDataPilotTable._getOutputRange()) ; - assure("_refresh failed.", _xDataPilotTable._refresh()) ; + new _XDataPilotTable(xDataPilotTable/*, log*/, param); + assertTrue("before failed.", _xDataPilotTable.before()); + assertTrue("_getOutputRange failed.", _xDataPilotTable._getOutputRange()) ; +// assertTrue("_refresh failed.", _xDataPilotTable._refresh()) ; // _XDataPilotDescriptor - XDataPilotDescriptor xDataPilotDescriptor = (XDataPilotDescriptor) + XDataPilotDescriptor xDataPilotDescriptor = UnoRuntime.queryInterface(XDataPilotDescriptor.class, mDataPilotTableObject); _XDataPilotDescriptor _xDataPilotDescriptor = - new _XDataPilotDescriptor(xDataPilotDescriptor, log, param); - assure("before failed.", _xDataPilotDescriptor.before()); - assure("_setTag failed.", _xDataPilotDescriptor._setTag()) ; - assure("_getTag failed.", _xDataPilotDescriptor._getTag()) ; - assure("_getFilterDescriptor failed.", _xDataPilotDescriptor._getFilterDescriptor()) ; - assure("_getDataPilotFields failed.", _xDataPilotDescriptor._getDataPilotFields()) ; - assure("_getColumnFields failed.", _xDataPilotDescriptor._getColumnFields()) ; - assure("_getRowFields failed.", _xDataPilotDescriptor._getRowFields()) ; - assure("_getDataFields failed.", _xDataPilotDescriptor._getDataFields()) ; - assure("_getHiddenFields failed.", _xDataPilotDescriptor._getHiddenFields()) ; - assure("_getPageFields failed.", _xDataPilotDescriptor._getPageFields()) ; - assure("_setSourceRange failed.", _xDataPilotDescriptor._setSourceRange()) ; - assure("_getSourceRange failed.", _xDataPilotDescriptor._getSourceRange()) ; + new _XDataPilotDescriptor(xDataPilotDescriptor/*, log*/, param); + assertTrue("before failed.", _xDataPilotDescriptor.before()); + assertTrue("_setTag failed.", _xDataPilotDescriptor._setTag()) ; + assertTrue("_getTag failed.", _xDataPilotDescriptor._getTag()) ; + assertTrue("_getFilterDescriptor failed.", _xDataPilotDescriptor._getFilterDescriptor()) ; + assertTrue("_getDataPilotFields failed.", _xDataPilotDescriptor._getDataPilotFields()) ; + assertTrue("_getColumnFields failed.", _xDataPilotDescriptor._getColumnFields()) ; + assertTrue("_getRowFields failed.", _xDataPilotDescriptor._getRowFields()) ; + assertTrue("_getDataFields failed.", _xDataPilotDescriptor._getDataFields()) ; + assertTrue("_getHiddenFields failed.", _xDataPilotDescriptor._getHiddenFields()) ; + assertTrue("_getPageFields failed.", _xDataPilotDescriptor._getPageFields()) ; + assertTrue("_setSourceRange failed.", _xDataPilotDescriptor._setSourceRange()) ; + assertTrue("_getSourceRange failed.", _xDataPilotDescriptor._getSourceRange()) ; } /** * create an environment for the test */ - public void before() { - Object oInterface = null; - XSpreadsheetDocument xSheetDoc = null; + @Before public void before() { +// Object oInterface = null; + + // SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)param.getMSF() ); + final XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + SOfficeFactory SOF = SOfficeFactory.getFactory(xMsf); - SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)param.getMSF() ); + param = new TestParameters(); + param.put("ServiceFactory", xMsf); // the cell range CellRangeAddress sCellRangeAdress = new CellRangeAddress(); @@ -174,7 +196,7 @@ public class CheckDataPilot extends ComplexTestCase { sCellAdress.Row = 8; try { - log.println( "Creating a Spreadsheet document" ); + System.out.println( "Creating a Spreadsheet document" ); xSheetDoc = SOF.createCalcDoc(null); } catch (com.sun.star.uno.Exception e) { // Some exception occures.FAILED @@ -182,11 +204,11 @@ public class CheckDataPilot extends ComplexTestCase { throw new StatusException( "Couldn't create document", e ); } - log.println("Getting a sheet"); - XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets(); + System.out.println("Getting a sheet"); + XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XSpreadsheet oSheet = null; XSpreadsheet oSheet2 = null; - XIndexAccess oIndexAccess = (XIndexAccess) + XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); try { @@ -206,7 +228,7 @@ public class CheckDataPilot extends ComplexTestCase { } try { - log.println("Filling a table"); + System.out.println("Filling a table"); for (int i = 1; i < mMaxFieldIndex; i++) { oSheet.getCellByPosition(i, 0).setFormula("Col" + i); oSheet.getCellByPosition(0, i).setFormula("Row" + i); @@ -215,10 +237,13 @@ public class CheckDataPilot extends ComplexTestCase { } for (int i = 1; i < mMaxFieldIndex; i++) - for (int j = 1; j < mMaxFieldIndex; j++) { + { + for (int j = 1; j < mMaxFieldIndex; j++) + { oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); } + } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(); throw new StatusException("Couldn't fill some cells", e); @@ -244,8 +269,8 @@ public class CheckDataPilot extends ComplexTestCase { // create the test objects - log.println("Getting test objects") ; - XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) + System.out.println("Getting test objects") ; + XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); XDataPilotTables DPT = DPTS.getDataPilotTables(); XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor(); @@ -254,7 +279,7 @@ public class CheckDataPilot extends ComplexTestCase { XPropertySet fieldPropSet = null; try { Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = (XPropertySet) + fieldPropSet = UnoRuntime.queryInterface(XPropertySet.class, oDataPilotField); } catch (com.sun.star.lang.WrappedTargetException e) { e.printStackTrace(); @@ -283,7 +308,7 @@ public class CheckDataPilot extends ComplexTestCase { throw new StatusException("Couldn't create a test environment", e); } - log.println("Insert the DataPilotTable"); + System.out.println("Insert the DataPilotTable"); if (DPT.hasByName("DataPilotTable")) { DPT.removeByName("DataPilotTable"); } @@ -326,4 +351,53 @@ public class CheckDataPilot extends ComplexTestCase { } + /* + * this method closes a calc document and resets the corresponding class variable xSheetDoc + */ + protected boolean closeSpreadsheetDocument() { + boolean worked = true; + + System.out.println(" disposing xSheetDoc "); + + try { + XCloseable oCloser = UnoRuntime.queryInterface( + XCloseable.class, xSheetDoc); + oCloser.close(true); + } catch (com.sun.star.util.CloseVetoException e) { + worked = false; + System.out.println("Couldn't close document"); + } catch (com.sun.star.lang.DisposedException e) { + worked = false; + System.out.println("Document already disposed"); + } catch (java.lang.NullPointerException e) { + worked = false; + System.out.println("Couldn't get XCloseable"); + } + + xSheetDoc = null; + + return worked; + } + + @After public void after() + { + closeSpreadsheetDocument(); + } + + + @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/sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java b/sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java index 57d6474f51b8..cae15163cbaa 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java +++ b/sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java @@ -38,7 +38,7 @@ import com.sun.star.lang.EventObject; import java.util.Random; import java.util.StringTokenizer; import lib.TestParameters; -import share.LogWriter; +// import share.LogWriter; //import lib.MultiMethodTest; import util.ValueChanger; import util.utils; @@ -72,7 +72,7 @@ public class _XPropertySet { /** * The log writer */ - private LogWriter log = null; + // private LogWriter log = null; /** * Flag that indicates change listener was called. @@ -144,9 +144,9 @@ public class _XPropertySet { * @param log A log writer * @param param The test parameters */ - public _XPropertySet(XPropertySet xObj, LogWriter log, TestParameters param) { + public _XPropertySet(XPropertySet xObj/*, LogWriter log*/, TestParameters param) { oObj = xObj; - this.log = log; + // this.log = log; this.param = param; } @@ -166,7 +166,7 @@ public class _XPropertySet { XPropertySetInfo propertySetInfo = oObj.getPropertySetInfo(); if (propertySetInfo == null) { - log.println("getPropertySetInfo() method returned null"); + System.out.println("getPropertySetInfo() method returned null"); String[] ptt = (String[]) param.get("PTT"); PTT.normal=ptt[0]; PTT.bound=ptt[1]; @@ -197,7 +197,7 @@ public class _XPropertySet { boolean result = true; if ( PTT.bound.equals("none") ) { - log.println("*** No bound properties found ***"); + System.out.println("*** No bound properties found ***"); } else { try { oObj.addPropertyChangeListener(PTT.bound,PClistener); @@ -205,25 +205,25 @@ public class _XPropertySet { oObj.setPropertyValue(PTT.bound, ValueChanger.changePValue(gValue)); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } // end of try-catch result = propertyChanged; if (!propertyChanged) { - log.println("propertyChangeListener wasn't called for '"+ + System.out.println("propertyChangeListener wasn't called for '"+ PTT.bound+"'"); } } //endif @@ -252,7 +252,7 @@ public class _XPropertySet { boolean result = true; if ( PTT.constrained.equals("none") ) { - log.println("*** No constrained properties found ***"); + System.out.println("*** No constrained properties found ***"); } else { try { oObj.addVetoableChangeListener(PTT.constrained,VClistener); @@ -260,25 +260,25 @@ public class _XPropertySet { oObj.setPropertyValue(PTT.constrained, ValueChanger.changePValue(gValue)); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } // end of try-catch result = vetoableChanged; if (!vetoableChanged) { - log.println("vetoableChangeListener wasn't called for '"+ + System.out.println("vetoableChangeListener wasn't called for '"+ PTT.constrained+"'"); } } //endif @@ -310,7 +310,7 @@ public class _XPropertySet { boolean result = true; if ( PTT.normal.equals("none") ) { - log.println("*** No changeable properties found ***"); + System.out.println("*** No changeable properties found ***"); } else { try { gValue = oObj.getPropertyValue(PTT.normal); @@ -318,21 +318,21 @@ public class _XPropertySet { oObj.setPropertyValue(PTT.normal, sValue); sValue = oObj.getPropertyValue(PTT.normal); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } // end of try-catch result = !gValue.equals(sValue); } //endif @@ -361,21 +361,21 @@ public class _XPropertySet { if ( PTT.normal.equals("none") ) { toCheck = oObj.getPropertySetInfo().getProperties()[0].Name; - log.println("All properties are Read Only"); - log.println("Using: "+toCheck); + System.out.println("All properties are Read Only"); + System.out.println("Using: "+toCheck); } try { Object gValue = oObj.getPropertyValue(toCheck); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to get property '"+ + System.out.println("Exception occured while trying to get property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); result = false; } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to get property '"+ + System.out.println("Exception occured while trying to get property '"+ PTT.normal+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); result = false; } // end of try-catch @@ -402,7 +402,7 @@ public class _XPropertySet { boolean result = true; if ( PTT.bound.equals("none") ) { - log.println("*** No bound properties found ***"); + System.out.println("*** No bound properties found ***"); } else { try { propertyChanged = false; @@ -411,26 +411,26 @@ public class _XPropertySet { oObj.setPropertyValue(PTT.bound, ValueChanger.changePValue(gValue)); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.bound+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } // end of try-catch result = !propertyChanged; if (propertyChanged) { - log.println("propertyChangeListener was called after removing"+ + System.out.println("propertyChangeListener was called after removing"+ " for '"+PTT.bound+"'"); } } //endif @@ -460,7 +460,7 @@ public class _XPropertySet { boolean result = true; if ( PTT.constrained.equals("none") ) { - log.println("*** No constrained properties found ***"); + System.out.println("*** No constrained properties found ***"); } else { try { oObj.removeVetoableChangeListener(PTT.constrained,VClistener); @@ -468,26 +468,26 @@ public class _XPropertySet { oObj.setPropertyValue(PTT.constrained, ValueChanger.changePValue(gValue)); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occured while trying to change "+ + System.out.println("Exception occured while trying to change "+ "property '"+ PTT.constrained+"'"); - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); } // end of try-catch result = !vetoableChanged; if (vetoableChanged) { - log.println("vetoableChangeListener was called after "+ + System.out.println("vetoableChangeListener was called after "+ "removing for '"+PTT.constrained+"'"); } } //endif @@ -512,7 +512,7 @@ public class _XPropertySet { Property property = properties[i]; String name = property.Name; - log.println("Checking '"+name+"'"); + System.out.println("Checking '"+name+"'"); boolean isWritable = ((property.Attributes & PropertyAttribute.READONLY) == 0); boolean isNotNull = ((property.Attributes & @@ -523,7 +523,7 @@ public class _XPropertySet { PropertyAttribute.CONSTRAINED) != 0); boolean canChange = false; - if ( !isWritable ) log.println("Property '"+name+"' is READONLY"); + if ( !isWritable ) System.out.println("Property '"+name+"' is READONLY"); if (name.endsWith("URL")) isWritable = false; if (name.startsWith("Fill")) isWritable = false; @@ -552,11 +552,11 @@ public class _XPropertySet { //get a random bound property PTT.bound=getRandomString(bound); - log.println("Bound: "+PTT.bound); + System.out.println("Bound: "+PTT.bound); //get a random constrained property PTT.constrained=getRandomString(constrained); - log.println("Constrained: "+PTT.constrained); + System.out.println("Constrained: "+PTT.constrained); //get a random normal property PTT.normal=getRandomString(normal); @@ -588,39 +588,39 @@ public class _XPropertySet { boolean hasChanged = false; try { Object getProp = oObj.getPropertyValue(name); - log.println("Getting: "+getProp); + System.out.println("Getting: "+getProp); Object setValue = null; if (getProp != null) { if (!utils.isVoid(getProp)) setValue = ValueChanger.changePValue(getProp); - else log.println("Property '"+name+ + else System.out.println("Property '"+name+ "' is void but MAYBEVOID isn't set"); - } else log.println("Property '"+name+"'is null and can't be changed"); + } else System.out.println("Property '"+name+"'is null and can't be changed"); if (name.equals("LineStyle")) setValue = null; if (setValue != null) { oObj.setPropertyValue(name, setValue); - log.println("Setting to :"+setValue); + System.out.println("Setting to :"+setValue); hasChanged = (! getProp.equals(oObj.getPropertyValue(name))); - } else log.println("Couldn't change Property '"+name+"'"); + } else System.out.println("Couldn't change Property '"+name+"'"); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } catch (com.sun.star.uno.RuntimeException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } catch (java.lang.ArrayIndexOutOfBoundsException e) { - log.println("'" + name + "' throws exception '" + e + "'"); - e.printStackTrace((java.io.PrintWriter)log); + System.out.println("'" + name + "' throws exception '" + e + "'"); + e.printStackTrace(); } return hasChanged; diff --git a/sc/qa/complex/dataPilot/interfaceTests/beans/makefile.mk b/sc/qa/complex/dataPilot/interfaceTests/beans/makefile.mk index 6ef9f7456cbb..22b29f5e0585 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/beans/makefile.mk +++ b/sc/qa/complex/dataPilot/interfaceTests/beans/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/..$/.. +PRJ = ../../../../.. TARGET = DataPilotInterfaceBeans PRJNAME = sc -PACKAGE = complex$/dataPilot$/interfaceTests$/beans +PACKAGE = complex/dataPilot/interfaceTests/beans # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk @@ -38,7 +38,7 @@ PACKAGE = complex$/dataPilot$/interfaceTests$/beans JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = _XPropertySet.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) # --- Targets ------------------------------------------------------ diff --git a/sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java b/sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java index 97763be2b199..d92b680e197e 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java +++ b/sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java @@ -29,8 +29,8 @@ package complex.dataPilot.interfaceTests.container; import com.sun.star.container.XNamed; import lib.TestParameters; -import share.LogWriter; -import util.utils; +// import share.LogWriter; +// import util.utils; /** * Testing com.sun.star.container.XNamed @@ -64,7 +64,7 @@ public class _XNamed { /** * The log writer */ - private LogWriter log = null; + // private LogWriter log = null; /** * Constructor: gets the object to test, a logger and the test parameters @@ -72,9 +72,9 @@ public class _XNamed { * @param log A log writer * @param param The test parameters */ - public _XNamed(XNamed xObj, LogWriter log, TestParameters param) { + public _XNamed(XNamed xObj/*, LogWriter log*/, TestParameters param) { oObj = xObj; - this.log = log; + // this.log = log; this.param = param; } @@ -87,7 +87,7 @@ public class _XNamed { public boolean _getName() { // write to log what we try next - log.println( "test for getName()" ); + System.out.println( "test for getName()" ); boolean result = true; boolean loc_result = true; @@ -95,10 +95,16 @@ public class _XNamed { String NewName = null; loc_result = ((name = oObj.getName()) != null); - log.println("getting the name \"" + name + "\""); - - if (loc_result) log.println("... getName() - OK"); - else log.println("... getName() - FAILED"); + System.out.println("getting the name \"" + name + "\""); + + if (loc_result) + { + System.out.println("... getName() - OK"); + } + else + { + System.out.println("... getName() - FAILED"); + } result &= loc_result; return result; } @@ -121,23 +127,29 @@ public class _XNamed { */ public boolean _setName(){ // requiredMethod("getName()"); - log.println("testing setName() ... "); + System.out.println("testing setName() ... "); String oldName = oObj.getName(); String NewName = oldName == null ? "XNamed" : oldName + "X" ; boolean result = true; boolean loc_result = true; - log.println("set the name of object to \"" + NewName + "\""); + System.out.println("set the name of object to \"" + NewName + "\""); oObj.setName(NewName); - log.println("check that container has element with this name"); + System.out.println("check that container has element with this name"); String name = oObj.getName(); - log.println("getting the name \"" + name + "\""); + System.out.println("getting the name \"" + name + "\""); loc_result = name.equals(NewName); - if (loc_result) log.println("... setName() - OK"); - else log.println("... setName() - FAILED"); + if (loc_result) + { + System.out.println("... setName() - OK"); + } + else + { + System.out.println("... setName() - FAILED"); + } result &= loc_result; oObj.setName(oldName); return result; diff --git a/sc/qa/complex/dataPilot/interfaceTests/container/makefile.mk b/sc/qa/complex/dataPilot/interfaceTests/container/makefile.mk index 675fe7be9a1c..d8b4321f0fd1 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/container/makefile.mk +++ b/sc/qa/complex/dataPilot/interfaceTests/container/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/..$/.. +PRJ = ../../../../.. TARGET = DataPilotInterfaceContainer PRJNAME = sc -PACKAGE = complex$/dataPilot$/interfaceTests$/container +PACKAGE = complex/dataPilot/interfaceTests/container # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk @@ -38,7 +38,7 @@ PACKAGE = complex$/dataPilot$/interfaceTests$/container JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = _XNamed.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) # --- Targets ------------------------------------------------------ diff --git a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java index 8358e5bb6106..a0cd423fc2a3 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java +++ b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java @@ -34,11 +34,11 @@ import com.sun.star.sheet.DataPilotFieldOrientation; import com.sun.star.sheet.XDataPilotDescriptor; import com.sun.star.table.CellRangeAddress; import com.sun.star.uno.UnoRuntime; -import lib.MultiMethodTest; -import lib.Status; +// import lib.MultiMethodTest; +// import lib.Status; //import lib.StatusException; import lib.TestParameters; -import share.LogWriter; +// import share.LogWriter; /** * Testing com.sun.star.sheet.XDataPilotDescriptor @@ -81,29 +81,29 @@ public class _XDataPilotDescriptor { /** * The log writer */ - private LogWriter log = null; +// private LogWriter log = null; /** * Constructor: gets the object to test, a logger and the test parameters * @param xObj The test object - * @param log A log writer * @param param The test parameters */ - public _XDataPilotDescriptor(XDataPilotDescriptor xObj, - LogWriter log, TestParameters param) { + public _XDataPilotDescriptor(XDataPilotDescriptor xObj/*, + LogWriter log*/, TestParameters param) { oObj = xObj; - this.log = log; + // this.log = log; this.param = param; } /** * Retrieves object relations. - * @throws StatusException If one of relations not found. - */ + + * @return + */ public boolean before() { Integer amount = (Integer)param.get("FIELDSAMOUNT"); if (amount == null) { - log.println("Relation 'FIELDSAMOUNT' not found"); + System.out.println("Relation 'FIELDSAMOUNT' not found"); return false; } tEnvFieldsAmount = amount.intValue(); @@ -118,7 +118,8 @@ public class _XDataPilotDescriptor { *
          *
        • setSourceRange() : to have current source range
        • *
        - */ + * @return + */ public boolean _getSourceRange(){ // requiredMethod("setSourceRange()"); boolean bResult = true; @@ -144,7 +145,8 @@ public class _XDataPilotDescriptor { *
      1. getHiddenFields()
      2. *
      3. getPageFields()
      4. * - */ + * @return + */ public boolean _setSourceRange(){ /* executeMethod("getColumnFields()") ; executeMethod("getRowFields()") ; @@ -167,7 +169,8 @@ public class _XDataPilotDescriptor { *
          *
        • setTag() : to have current tag
        • *
        - */ + * @return + */ public boolean _getTag(){ // requiredMethod("setTag()"); boolean bResult = true; @@ -181,7 +184,8 @@ public class _XDataPilotDescriptor { /** * Test just calls the method.

        * Has OK status if the method successfully returns.

        - */ + * @return + */ public boolean _setTag(){ oObj.setTag(sTag); return true; @@ -195,22 +199,23 @@ public class _XDataPilotDescriptor { * Has OK status if returned value isn't null, number of fields * goten from returned value is less than number of fields obtained by relation * and no exceptions were thrown.

        - */ + * @return + */ public boolean _getDataPilotFields(){ boolean bResult = true; XIndexAccess IA = null; IA = oObj.getDataPilotFields(); if (IA == null) { - log.println("Returned value is null."); + System.out.println("Returned value is null."); return false; - } else {log.println("getDataPilotFields returned not Null value -- OK");} + } else {System.out.println("getDataPilotFields returned not Null value -- OK");} fieldsAmount = IA.getCount(); if (fieldsAmount < tEnvFieldsAmount) { - log.println("Number of fields is less than number goten by relation."); + System.out.println("Number of fields is less than number goten by relation."); return false; - } else {log.println("count of returned fields -- OK");} + } else {System.out.println("count of returned fields -- OK");} fieldsNames = new String[tEnvFieldsAmount]; int i = -1 ; @@ -220,24 +225,23 @@ public class _XDataPilotDescriptor { try { field = IA.getByIndex(i); } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } - XNamed named = (XNamed) - UnoRuntime.queryInterface(XNamed.class, field); + XNamed named = UnoRuntime.queryInterface(XNamed.class, field); String name = named.getName(); - log.println("Field : '" + name + "' ... ") ; + System.out.println("Field : '" + name + "' ... ") ; if (!name.equals("Data")) { fieldsNames[cnt] = name ; - XPropertySet props = (XPropertySet) + XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, field); try { @@ -245,44 +249,49 @@ public class _XDataPilotDescriptor { case 0 : props.setPropertyValue("Orientation", DataPilotFieldOrientation.COLUMN); - log.println(" Column") ; + System.out.println(" Column") ; break; case 1 : props.setPropertyValue("Orientation", DataPilotFieldOrientation.ROW); - log.println(" Row") ; + System.out.println(" Row") ; break; case 2 : props.setPropertyValue("Orientation", DataPilotFieldOrientation.DATA); - log.println(" Data") ; + System.out.println(" Data") ; break; case 3 : props.setPropertyValue("Orientation", DataPilotFieldOrientation.HIDDEN); - log.println(" Hidden") ; + System.out.println(" Hidden") ; break; case 4 : props.setPropertyValue("Orientation", DataPilotFieldOrientation.PAGE); - log.println(" Page") ; + System.out.println(" Page") ; props.setPropertyValue("CurrentPage", "20"); break; } } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false; } - if (++cnt > 4) break; - } else { + if (++cnt > 4) + { + break; + } + } + else + { return false; } } @@ -299,10 +308,11 @@ public class _XDataPilotDescriptor { *

          *
        • getDataPilotFields() : to have array of field names
        • *
        - */ + * @return + */ public boolean _getColumnFields(){ // requiredMethod("getDataPilotFields()"); - log.println("getColumnFields") ; + System.out.println("getColumnFields") ; XIndexAccess IA = oObj.getColumnFields(); return CheckNames(IA, 0); } @@ -316,10 +326,11 @@ public class _XDataPilotDescriptor { *
          *
        • getDataPilotFields() : to have array of field names
        • *
        - */ + * @return + */ public boolean _getDataFields(){ // requiredMethod("getDataPilotFields()"); - log.println("getDataFields") ; + System.out.println("getDataFields") ; XIndexAccess IA = oObj.getDataFields(); return CheckNames(IA, 2); } @@ -333,10 +344,11 @@ public class _XDataPilotDescriptor { *
          *
        • getDataPilotFields() : to have array of field names
        • *
        - */ + * @return + */ public boolean _getHiddenFields(){ // requiredMethod("getDataPilotFields()"); - log.println("getHiddenFields") ; + System.out.println("getHiddenFields") ; XIndexAccess IA = oObj.getHiddenFields(); return CheckNames(IA, 3); } @@ -350,10 +362,11 @@ public class _XDataPilotDescriptor { *
          *
        • getDataPilotFields() : to have array of field names
        • *
        - */ + * @return + */ public boolean _getRowFields(){ // requiredMethod("getDataPilotFields()"); - log.println("getRowFields") ; + System.out.println("getRowFields") ; XIndexAccess IA = oObj.getRowFields(); boolean bResult = CheckNames(IA, 1); return bResult; @@ -367,10 +380,11 @@ public class _XDataPilotDescriptor { *
          *
        • getDataPilotFields() : to have array of field names
        • *
        - */ + * @return + */ public boolean _getPageFields(){ // requiredMethod("getDataPilotFields()"); - log.println("getPageFields") ; + System.out.println("getPageFields") ; XIndexAccess IA = oObj.getPageFields(); boolean bResult = CheckNames(IA, 4); return bResult; @@ -380,7 +394,8 @@ public class _XDataPilotDescriptor { * Test calls the method and checks returned value.

        * Has OK status if returned value isn't null * and no exceptions were thrown.

        - */ + * @return + */ public boolean _getFilterDescriptor(){ boolean bResult = oObj.getFilterDescriptor() != null; return bResult; @@ -396,46 +411,46 @@ public class _XDataPilotDescriptor { * false otherwise * @see com.sun.star.container.XNamed */ - boolean CheckNames(XIndexAccess IA, int rem) { + private boolean CheckNames(XIndexAccess IA, int rem) { String name = null; if (IA == null) { - log.println("Null retruned.") ; + System.out.println("Null retruned.") ; return false ; } if (fieldsNames[rem] == null) { - log.println("No fields were set to this orientation - cann't check result") ; + System.out.println("No fields were set to this orientation - cann't check result") ; return true ; } if (IA.getCount() == 0) { - log.println("No fields found. Must be at least '" + System.out.println("No fields found. Must be at least '" + fieldsNames[rem] + "'") ; return false ; } try { - log.println("Fields returned ") ; + System.out.println("Fields returned ") ; for (int i = 0; i < IA.getCount(); i++) { Object field = IA.getByIndex(i); - XNamed named = (XNamed)UnoRuntime.queryInterface + XNamed named = UnoRuntime.queryInterface (XNamed.class, field); name = named.getName(); - log.println(" " + name) ; + System.out.println(" " + name) ; if (fieldsNames[rem].equals(name)) { - log.println(" - OK") ; + System.out.println(" - OK") ; return true ; } } } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false ; } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((java.io.PrintWriter)log); + e.printStackTrace(); return false ; } - log.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; + System.out.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; return false ; } diff --git a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java index d7f6e81b91e5..29c6274ef7a8 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java +++ b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java @@ -31,10 +31,10 @@ import com.sun.star.sheet.XDataPilotTable; import com.sun.star.table.CellAddress; import com.sun.star.table.CellRangeAddress; import com.sun.star.table.XCell; -import lib.Status; +// import lib.Status; //import lib.StatusException; import lib.TestParameters; -import share.LogWriter; +// import share.LogWriter; /** * Testing com.sun.star.sheet.XDataPilotTable @@ -71,18 +71,18 @@ public class _XDataPilotTable { /** * The log writer */ - private LogWriter log = null; + // private LogWriter log = null; /** * Constructor: gets the object to test, a logger and the test parameters * @param xObj The test object - * @param log A log writer + * @param param The test parameters */ - public _XDataPilotTable(XDataPilotTable xObj, - LogWriter log, TestParameters param) { + public _XDataPilotTable(XDataPilotTable xObj/*, + LogWriter log*/, TestParameters param) { oObj = xObj; - this.log = log; + // this.log = log; this.param = param; } @@ -94,7 +94,7 @@ public class _XDataPilotTable { if (xCellForChange == null || OutputRange == null || xCellForCheck == null) { - log.println("Relation not found"); + System.out.println("Relation not found"); return false; } return true; @@ -103,7 +103,8 @@ public class _XDataPilotTable { * Test calls the method and checks returned value using value obtained by * object relation 'OUTPUTRANGE'.

        * Has OK status if values are equal.

        - */ + * @return + */ public boolean _getOutputRange(){ boolean bResult = true; CellRangeAddress objRange = oObj.getOutputRange(); @@ -119,13 +120,14 @@ public class _XDataPilotTable { * relation 'CELLFORCHECK'.

        * Has OK status if value of the cell obtained by object relation * 'CELLFORCHECK' is changed.

        - */ + * @return + */ public boolean _refresh(){ xCellForChange.setValue(changeValue); double oldData = xCellForCheck.getValue(); oObj.refresh(); double newData = xCellForCheck.getValue(); - log.println("Old data:" + oldData + "; new data:" + newData); + System.out.println("Old data:" + oldData + "; new data:" + newData); return oldData != newData; } diff --git a/sc/qa/complex/dataPilot/interfaceTests/sheet/makefile.mk b/sc/qa/complex/dataPilot/interfaceTests/sheet/makefile.mk index 350e3fcb8f19..f62d17614222 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/makefile.mk +++ b/sc/qa/complex/dataPilot/interfaceTests/sheet/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/..$/.. +PRJ = ../../../../.. TARGET = DataPilotInterfaceSheet PRJNAME = sc -PACKAGE = complex$/dataPilot$/interfaceTests$/sheet +PACKAGE = complex/dataPilot/interfaceTests/sheet # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk @@ -38,7 +38,7 @@ PACKAGE = complex$/dataPilot$/interfaceTests$/sheet JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = _XDataPilotDescriptor.java _XDataPilotTable.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) # --- Targets ------------------------------------------------------ diff --git a/sc/qa/complex/dataPilot/makefile.mk b/sc/qa/complex/dataPilot/makefile.mk index a0bf1df34d0e..2777971e2f5a 100644 --- a/sc/qa/complex/dataPilot/makefile.mk +++ b/sc/qa/complex/dataPilot/makefile.mk @@ -25,34 +25,33 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = DataPilot -PRJNAME = sc -PACKAGE = complex$/dataPilot - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_datapilot -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CheckDataPilot.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/dataPilot +JAVATESTFILES = \ + CheckDataPilot.java -SUBDIRS = interfaceTests$/beans interfaceTests$/container interfaceTests$/sheet -#----- make a jar from compiled files ------------------------------ +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -MAXLINELENGTH = 100000 +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) +SUBDIRS = interfaceTests/beans interfaceTests/container interfaceTests/sheet -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +.END -# --- Targets ------------------------------------------------------ +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -.INCLUDE : target.mk +ALLTAR : javatest +.END -run: - +java -cp $(CLASSPATH) org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) diff --git a/sc/qa/complex/sc/CalcRTL.java b/sc/qa/complex/sc/CalcRTL.java index 9528c34b9267..c9fad2fec9c5 100644 --- a/sc/qa/complex/sc/CalcRTL.java +++ b/sc/qa/complex/sc/CalcRTL.java @@ -44,23 +44,32 @@ import com.sun.star.sheet.XCellRangeAddressable; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; -import com.sun.star.table.XCell; +// import com.sun.star.table.XCell; import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XCloseable; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; -import java.io.PrintWriter; +// import java.io.PrintWriter; import util.DrawTools; import util.SOfficeFactory; import util.ValueComparer; +// 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 CalcRTL extends ComplexTestCase { + +public class CalcRTL /* extends ComplexTestCase */ +{ XSpreadsheetDocument xSheetDoc = null; /* @@ -74,12 +83,12 @@ public class CalcRTL extends ComplexTestCase { *
        * 3. A calc document is opened and a shape inserted, afterwards the effect of changing the TableLayout to the shape is checked */ - public String[] getTestMethodNames() { - return new String[] { - "checkSpreadsheetProperties", "checkShapeProperties", - "checkInfluenceOfSpreadsheetChange" - }; - } +// public String[] getTestMethodNames() { +// return new String[] { +// "checkSpreadsheetProperties", "checkShapeProperties", +// "checkInfluenceOfSpreadsheetChange" +// }; +// } /* * In this method a spreadsheet document is opened
        @@ -92,26 +101,26 @@ public class CalcRTL extends ComplexTestCase { *

      5. TableLayout * */ - public void checkSpreadsheetProperties() { - assure("Couldn't open document", openSpreadsheetDocument()); + @Test public void checkSpreadsheetProperties() { + assertTrue("Couldn't open document", openSpreadsheetDocument()); - XPropertySet set = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet set = UnoRuntime.queryInterface( XPropertySet.class, getSpreadsheet()); - assure("Problems when setting property 'IsVisible'", + assertTrue("Problems when setting property 'IsVisible'", changeProperty(set, "IsVisible", Boolean.FALSE)); - assure("Problems when setting property 'IsVisible'", + assertTrue("Problems when setting property 'IsVisible'", changeProperty(set, "IsVisible", Boolean.TRUE)); - assure("Problems when setting property 'PageStyle'", + assertTrue("Problems when setting property 'PageStyle'", changeProperty(set, "PageStyle", "Report")); - assure("Problems when setting property 'PageStyle'", + assertTrue("Problems when setting property 'PageStyle'", changeProperty(set, "PageStyle", "Default")); - assure("Problems when setting property 'TableLayout'", + assertTrue("Problems when setting property 'TableLayout'", changeProperty(set, "TableLayout", new Short(com.sun.star.text.WritingMode2.RL_TB))); - assure("Problems when setting property 'TableLayout'", + assertTrue("Problems when setting property 'TableLayout'", changeProperty(set, "TableLayout", new Short(com.sun.star.text.WritingMode2.LR_TB))); - assure("Couldn't close document", closeSpreadsheetDocument()); + assertTrue("Couldn't close document", closeSpreadsheetDocument()); } /* @@ -125,67 +134,69 @@ public class CalcRTL extends ComplexTestCase { *
      6. VertOrientPosition * */ - public void checkShapeProperties() { - assure("Couldn't open document", openSpreadsheetDocument()); + @Test public void checkShapeProperties() { + assertTrue("Couldn't open document", openSpreadsheetDocument()); - XPropertySet set = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet set = UnoRuntime.queryInterface( XPropertySet.class, getInsertedShape()); try { - assure("Problems when setting property 'Anchor'", + assertTrue("Problems when setting property 'Anchor'", changeProperty(set, "Anchor", getSpreadsheet().getCellByPosition(5, 5))); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - assure("Problems when setting property 'Anchor'", false); + // assure("Problems when setting property 'Anchor'", false); + fail("Problems when setting property 'Anchor'"); } - assure("Problems when setting property 'HoriOrientPosition'", + assertTrue("Problems when setting property 'HoriOrientPosition'", changeProperty(set, "HoriOrientPosition", new Integer(1000))); - assure("Problems when setting property 'VertOrientPosition'", + assertTrue("Problems when setting property 'VertOrientPosition'", changeProperty(set, "VertOrientPosition", new Integer(1000))); - assure("Couldn't close document", closeSpreadsheetDocument()); + assertTrue("Couldn't close document", closeSpreadsheetDocument()); } - public void checkInfluenceOfSpreadsheetChange() { - assure("Couldn't open document", openSpreadsheetDocument()); + @Test public void checkInfluenceOfSpreadsheetChange() { + assertTrue("Couldn't open document", openSpreadsheetDocument()); XShape oShape = getInsertedShape(); - XPropertySet sheetProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet sheetProps = UnoRuntime.queryInterface( XPropertySet.class, getSpreadsheet()); - XPropertySet shapeProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet shapeProps = UnoRuntime.queryInterface( XPropertySet.class, oShape); String[] previous = getShapeProps(shapeProps, oShape); - assure("Problems when setting property 'TableLayout'", + assertTrue("Problems when setting property 'TableLayout'", changeProperty(sheetProps, "TableLayout", new Short(com.sun.star.text.WritingMode2.RL_TB))); String[] RL_TB = getShapeProps(shapeProps, oShape); - assure("Problems when setting property 'TableLayout'", + assertTrue("Problems when setting property 'TableLayout'", changeProperty(sheetProps, "TableLayout", new Short(com.sun.star.text.WritingMode2.LR_TB))); String[] LR_TB = getShapeProps(shapeProps, oShape); - assure("Anchor has changed", + assertTrue("Anchor has changed", (previous[0].equals(RL_TB[0]) && previous[0].equals(LR_TB[0]))); - assure("HoriOrientPosition has changed", - (Integer.valueOf(previous[1]).intValue() + Integer.valueOf( + assertEquals("HoriOrientPosition has changed", + 2100, (Integer.valueOf(previous[1]).intValue() + Integer.valueOf( RL_TB[1]) .intValue() + - Integer.valueOf(LR_TB[1]).intValue() == 2099)); - assure("VertOrientPosition has changed", + Integer.valueOf(LR_TB[1]).intValue())); + assertEquals("VertOrientPosition has changed", + 3*Integer.valueOf(previous[2]).intValue(), (Integer.valueOf(previous[2]).intValue() + Integer.valueOf( RL_TB[2]) .intValue() + - Integer.valueOf(LR_TB[2]).intValue() == 3*Integer.valueOf(previous[2]).intValue())); - assure("x-position hasn't changed", + Integer.valueOf(LR_TB[2]).intValue())); + assertTrue("x-position hasn't changed", (previous[3].equals(LR_TB[3]) && ((Integer.valueOf(previous[3]).intValue() * (-1)) - oShape.getSize().Width != Integer.valueOf(LR_TB[2]) .intValue()))); - assure("Couldn't close document", closeSpreadsheetDocument()); + assertTrue("Couldn't close document", closeSpreadsheetDocument()); } protected String[] getShapeProps(XPropertySet set, XShape oShape) { @@ -200,10 +211,10 @@ public class CalcRTL extends ComplexTestCase { } catch (com.sun.star.lang.WrappedTargetException e) { } - log.println("\t Anchor :" + reValue[0]); - log.println("\t HoriOrientPosition :" + reValue[1]); - log.println("\t VertOrientPosition :" + reValue[2]); - log.println("\t Shape Position (x,y) : (" + oShape.getPosition().X + + System.out.println("\t Anchor :" + reValue[0]); + System.out.println("\t HoriOrientPosition :" + reValue[1]); + System.out.println("\t VertOrientPosition :" + reValue[2]); + System.out.println("\t Shape Position (x,y) : (" + oShape.getPosition().X + "," + oShape.getPosition().Y + ")"); return reValue; @@ -213,17 +224,21 @@ public class CalcRTL extends ComplexTestCase { * this method opens a calc document and sets the corresponding class variable xSheetDoc */ protected boolean openSpreadsheetDocument() { - SOfficeFactory SOF = SOfficeFactory.getFactory( - (XMultiServiceFactory) param.getMSF()); + // SOfficeFactory SOF = SOfficeFactory.getFactory( + // (XMultiServiceFactory) param.getMSF()); + + final XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + SOfficeFactory SOF = SOfficeFactory.getFactory(xMsf); + boolean worked = true; try { - log.println("creating a sheetdocument"); + System.out.println("creating a sheetdocument"); xSheetDoc = SOF.createCalcDoc(null); } catch (com.sun.star.uno.Exception e) { // Some exception occures.FAILED worked = false; - e.printStackTrace((PrintWriter) log); + e.printStackTrace(/*(PrintWriter) log*/ System.out); } return worked; @@ -235,21 +250,21 @@ public class CalcRTL extends ComplexTestCase { protected boolean closeSpreadsheetDocument() { boolean worked = true; - log.println(" disposing xSheetDoc "); + System.out.println(" disposing xSheetDoc "); try { - XCloseable oCloser = (XCloseable) UnoRuntime.queryInterface( + XCloseable oCloser = UnoRuntime.queryInterface( XCloseable.class, xSheetDoc); oCloser.close(true); } catch (com.sun.star.util.CloseVetoException e) { worked = false; - log.println("Couldn't close document"); + System.out.println("Couldn't close document"); } catch (com.sun.star.lang.DisposedException e) { worked = false; - log.println("Document already disposed"); + System.out.println("Document already disposed"); } catch (java.lang.NullPointerException e) { worked = false; - log.println("Couldn't get XCloseable"); + System.out.println("Couldn't get XCloseable"); } xSheetDoc = null; @@ -264,22 +279,22 @@ public class CalcRTL extends ComplexTestCase { protected XSpreadsheet getSpreadsheet() { XSpreadsheet oSheet = null; - log.println("getting sheets"); + System.out.println("getting sheets"); - XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets(); + XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); - log.println("getting a sheet"); + System.out.println("getting a sheet"); - XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( + XIndexAccess oIndexAccess = UnoRuntime.queryInterface( XIndexAccess.class, xSpreadsheets); try { - oSheet = (XSpreadsheet) UnoRuntime.queryInterface( + oSheet = UnoRuntime.queryInterface( XSpreadsheet.class, oIndexAccess.getByIndex(0)); } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((PrintWriter) log); + e.printStackTrace(System.out); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace((PrintWriter) log); + e.printStackTrace(System.out); } return oSheet; @@ -361,19 +376,19 @@ public class CalcRTL extends ComplexTestCase { //check get-set methods if (maybeVoid) { - log.println("Property " + propName + " is void"); + System.out.println("Property " + propName + " is void"); } if (readOnly) { - log.println("Property " + propName + " is readOnly"); + System.out.println("Property " + propName + " is readOnly"); } if (util.utils.isVoid(oldValue) && !maybeVoid) { - log.println(propName + " is void, but it's not MAYBEVOID"); + System.out.println(propName + " is void, but it's not MAYBEVOID"); return false; } else if (oldValue == null) { - log.println(propName + + System.out.println(propName + " has null value, and therefore can't be changed"); return true; @@ -382,26 +397,26 @@ public class CalcRTL extends ComplexTestCase { if (exception != null) { if (exception instanceof PropertyVetoException) { // the change of read only prohibited - OK - log.println("Property is ReadOnly and wasn't changed"); - log.println("Property '" + propName + "' OK"); + System.out.println("Property is ReadOnly and wasn't changed"); + System.out.println("Property '" + propName + "' OK"); return true; } else if (exception instanceof IllegalArgumentException) { // the change of read only prohibited - OK - log.println("Property is ReadOnly and wasn't changed"); - log.println("Property '" + propName + "' OK"); + System.out.println("Property is ReadOnly and wasn't changed"); + System.out.println("Property '" + propName + "' OK"); return true; } else if (exception instanceof UnknownPropertyException) { // the change of read only prohibited - OK - log.println("Property is ReadOnly and wasn't changed"); - log.println("Property '" + propName + "' OK"); + System.out.println("Property is ReadOnly and wasn't changed"); + System.out.println("Property '" + propName + "' OK"); return true; } else if (exception instanceof RuntimeException) { // the change of read only prohibited - OK - log.println("Property is ReadOnly and wasn't changed"); - log.println("Property '" + propName + "' OK"); + System.out.println("Property is ReadOnly and wasn't changed"); + System.out.println("Property '" + propName + "' OK"); return true; } else { @@ -411,7 +426,7 @@ public class CalcRTL extends ComplexTestCase { // if no exception - check that value // has not changed if (!ValueComparer.equalValue(resValue, oldValue)) { - log.println("Read only property '" + propName + + System.out.println("Read only property '" + propName + "' has changed"); try { @@ -422,17 +437,17 @@ public class CalcRTL extends ComplexTestCase { oldValue); } - log.println("old = " + toString(oldValue)); - log.println("new = " + toString(newValue)); - log.println("result = " + toString(resValue)); + System.out.println("old = " + toString(oldValue)); + System.out.println("new = " + toString(newValue)); + System.out.println("result = " + toString(resValue)); } catch (com.sun.star.lang.IllegalArgumentException iae) { } return false; } else { - log.println("Read only property '" + propName + + System.out.println("Read only property '" + propName + "' hasn't changed"); - log.println("Property '" + propName + "' OK"); + System.out.println("Property '" + propName + "' OK"); return true; } @@ -443,7 +458,7 @@ public class CalcRTL extends ComplexTestCase { // check that the new value is set if ((!ValueComparer.equalValue(resValue, newValue)) || (ValueComparer.equalValue(resValue, oldValue))) { - log.println("Value for '" + propName + + System.out.println("Value for '" + propName + "' hasn't changed as expected"); try { @@ -454,16 +469,16 @@ public class CalcRTL extends ComplexTestCase { oldValue); } - log.println("old = " + toString(oldValue)); - log.println("new = " + toString(newValue)); - log.println("result = " + toString(resValue)); + System.out.println("old = " + toString(oldValue)); + System.out.println("new = " + toString(newValue)); + System.out.println("result = " + toString(resValue)); } catch (com.sun.star.lang.IllegalArgumentException iae) { } if (resValue != null) { if ((!ValueComparer.equalValue(resValue, oldValue)) || (!resValue.equals(oldValue))) { - log.println("But it has changed."); + System.out.println("But it has changed."); return true; } else { @@ -475,7 +490,7 @@ public class CalcRTL extends ComplexTestCase { //tRes.tested(propName, false); } else { - log.println("Property '" + propName + "' OK"); + System.out.println("Property '" + propName + "' OK"); try { if (!util.utils.isVoid(oldValue) && @@ -485,9 +500,9 @@ public class CalcRTL extends ComplexTestCase { oldValue); } - log.println("old = " + toString(oldValue)); - log.println("new = " + toString(newValue)); - log.println("result = " + toString(resValue)); + System.out.println("old = " + toString(oldValue)); + System.out.println("new = " + toString(newValue)); + System.out.println("result = " + toString(resValue)); } catch (com.sun.star.lang.IllegalArgumentException iae) { } @@ -514,7 +529,7 @@ public class CalcRTL extends ComplexTestCase { Object value = null; if (UnoRuntime.queryInterface(XCellRangeAddressable.class, obj) != null) { - XCellRangeAddressable aCell = (XCellRangeAddressable) UnoRuntime.queryInterface( + XCellRangeAddressable aCell = UnoRuntime.queryInterface( XCellRangeAddressable.class, obj); value = "Cell in Column " + aCell.getRangeAddress().StartColumn + @@ -533,35 +548,54 @@ public class CalcRTL extends ComplexTestCase { XShape insertedShape = null; try { - log.println("getting Drawpages"); + System.out.println("getting Drawpages"); - XDrawPagesSupplier oDPS = (XDrawPagesSupplier) UnoRuntime.queryInterface( + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface( XDrawPagesSupplier.class, xSheetDoc); - XDrawPages oDP = (XDrawPages) oDPS.getDrawPages(); - XDrawPage firstDrawPage = (XDrawPage) UnoRuntime.queryInterface( + XDrawPages oDP = oDPS.getDrawPages(); + XDrawPage firstDrawPage = UnoRuntime.queryInterface( XDrawPage.class, oDP.getByIndex(0)); - SOfficeFactory SOF = SOfficeFactory.getFactory( - (XMultiServiceFactory) param.getMSF()); - XComponent xComp = (XComponent) UnoRuntime.queryInterface( + final XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + SOfficeFactory SOF = SOfficeFactory.getFactory(xMsf); + + // SOfficeFactory SOF = SOfficeFactory.getFactory( + // (XMultiServiceFactory) param.getMSF()); + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xSheetDoc); insertedShape = SOF.createShape(xComp, 5000, 3500, 700, 500, "Rectangle"); DrawTools.getShapes(firstDrawPage).add(insertedShape); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't create instance"); - e.printStackTrace((PrintWriter) log); + System.out.println("Couldn't create instance"); + e.printStackTrace(); return null; } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't create instance"); - e.printStackTrace((PrintWriter) log); + System.out.println("Couldn't create instance"); + e.printStackTrace(); return null; } return insertedShape; } -} \ No newline at end of file + + + + + @BeforeClass public static void setUpConnection() throws Exception { + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + +} diff --git a/sc/qa/complex/sc/makefile.mk b/sc/qa/complex/sc/makefile.mk index 097e6d0c5500..e064f9d3bd43 100644 --- a/sc/qa/complex/sc/makefile.mk +++ b/sc/qa/complex/sc/makefile.mk @@ -25,33 +25,27 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = CalcRTL -PRJNAME = sc -PACKAGE = complex$/sc - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CalcRTL.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_sc -# --- Targets ------------------------------------------------------ +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/sc +JAVATESTFILES = \ + CalcRTL.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END -.INCLUDE : target.mk +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk +ALLTAR : javatest -run: - +java -cp "$(CLASSPATH)" org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) +.END -- cgit v1.2.3 From 8b60331846c7dba554e1c4227a751b7a2603f0e5 Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Tue, 8 Jun 2010 09:10:15 +0200 Subject: sb123:#i111449# fix in calcPreview Test --- sc/qa/complex/calcPreview/TestDocument.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/qa/complex/calcPreview/TestDocument.java b/sc/qa/complex/calcPreview/TestDocument.java index 294154999fe7..a568556e62f4 100644 --- a/sc/qa/complex/calcPreview/TestDocument.java +++ b/sc/qa/complex/calcPreview/TestDocument.java @@ -32,7 +32,7 @@ import org.openoffice.test.OfficeFileUrl; final class TestDocument { public static String getUrl(String name) { - return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); + return OfficeFileUrl.getAbsolute(new File("test_documents", name)); } private TestDocument() {} -- cgit v1.2.3 From a1587de76a1112479dfbc67d60cafceb7ee59de7 Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Thu, 1 Jul 2010 13:19:11 +0200 Subject: sb123:#i111449# cleanups in build.lst for qa/complex tests --- sc/prj/build.lst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 4631dae8e3d4..c807f7b445e8 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -53,5 +53,8 @@ sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr # sc sc\qa\complex\calcPreview nmake - all qa_calcpreview NULL sc sc\qa\complex\cellRanges nmake - all qa_cellranges sc_util NULL -sc sc\qa\complex\dataPilot nmake - all qa_datapilot sc_util NULL +sc sc\qa\complex\dataPilot\interfaceTests\beans nmake - all qa_datapilot_ifacetst_beans sc_util NULL +sc sc\qa\complex\dataPilot\interfaceTests\container nmake - all qa_datapilot_ifacetst_container sc_util NULL +sc sc\qa\complex\dataPilot\interfaceTests\sheet nmake - all qa_datapilot_ifacetst_sheet sc_util NULL +sc sc\qa\complex\dataPilot nmake - all qa_datapilot qa_datapilot_ifacetst_beans qa_datapilot_ifacetst_container qa_datapilot_ifacetst_sheet sc_util NULL sc sc\qa\complex\sc nmake - all qa_sc sc_util NULL -- cgit v1.2.3 From 1fec19d2ce346d6807a96e7237fd6286c0bf8897 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 28 Jul 2010 14:15:51 +0200 Subject: sb123: #i111449# building sc/qa/complex/dataPilot fails due to SUBDIRS in makefile.mk --- sc/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 98d2acabfef5..e84a53ab5747 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -56,5 +56,5 @@ sc sc\qa\complex\cellRanges nmake - sc sc\qa\complex\dataPilot\interfaceTests\beans nmake - all qa_datapilot_ifacetst_beans sc_util NULL sc sc\qa\complex\dataPilot\interfaceTests\container nmake - all qa_datapilot_ifacetst_container sc_util NULL sc sc\qa\complex\dataPilot\interfaceTests\sheet nmake - all qa_datapilot_ifacetst_sheet sc_util NULL -sc sc\qa\complex\dataPilot nmake - all qa_datapilot qa_datapilot_ifacetst_beans qa_datapilot_ifacetst_container qa_datapilot_ifacetst_sheet sc_util NULL +#sc sc\qa\complex\dataPilot nmake - all qa_datapilot qa_datapilot_ifacetst_beans qa_datapilot_ifacetst_container qa_datapilot_ifacetst_sheet sc_util NULL sc sc\qa\complex\sc nmake - all qa_sc sc_util NULL -- cgit v1.2.3 From 43a2391a2e5e81f88cd25efa1deb6fc260cc2104 Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Mon, 23 Aug 2010 10:38:44 +0200 Subject: sb123:#i111449# remove all subdirs in complex tests --- sc/prj/build.lst | 3 - sc/qa/complex/dataPilot/CheckDataPilot.java | 8 +- sc/qa/complex/dataPilot/_XDataPilotDescriptor.java | 464 +++++++++++++++ sc/qa/complex/dataPilot/_XDataPilotTable.java | 135 +++++ sc/qa/complex/dataPilot/_XNamed.java | 159 ++++++ sc/qa/complex/dataPilot/_XPropertySet.java | 631 +++++++++++++++++++++ .../interfaceTests/beans/_XPropertySet.java | 631 --------------------- .../interfaceTests/container/_XNamed.java | 159 ------ .../sheet/_XDataPilotDescriptor.java | 464 --------------- .../interfaceTests/sheet/_XDataPilotTable.java | 135 ----- sc/qa/complex/dataPilot/makefile.mk | 10 +- 11 files changed, 1399 insertions(+), 1400 deletions(-) create mode 100644 sc/qa/complex/dataPilot/_XDataPilotDescriptor.java create mode 100644 sc/qa/complex/dataPilot/_XDataPilotTable.java create mode 100644 sc/qa/complex/dataPilot/_XNamed.java create mode 100644 sc/qa/complex/dataPilot/_XPropertySet.java delete mode 100644 sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java delete mode 100644 sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java delete mode 100644 sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java delete mode 100644 sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java diff --git a/sc/prj/build.lst b/sc/prj/build.lst index e84a53ab5747..08d9f97b23f4 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -53,8 +53,5 @@ sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr # sc sc\qa\complex\calcPreview nmake - all qa_calcpreview NULL sc sc\qa\complex\cellRanges nmake - all qa_cellranges sc_util NULL -sc sc\qa\complex\dataPilot\interfaceTests\beans nmake - all qa_datapilot_ifacetst_beans sc_util NULL -sc sc\qa\complex\dataPilot\interfaceTests\container nmake - all qa_datapilot_ifacetst_container sc_util NULL -sc sc\qa\complex\dataPilot\interfaceTests\sheet nmake - all qa_datapilot_ifacetst_sheet sc_util NULL #sc sc\qa\complex\dataPilot nmake - all qa_datapilot qa_datapilot_ifacetst_beans qa_datapilot_ifacetst_container qa_datapilot_ifacetst_sheet sc_util NULL sc sc\qa\complex\sc nmake - all qa_sc sc_util NULL diff --git a/sc/qa/complex/dataPilot/CheckDataPilot.java b/sc/qa/complex/dataPilot/CheckDataPilot.java index 5fae88450c04..b042f259072e 100644 --- a/sc/qa/complex/dataPilot/CheckDataPilot.java +++ b/sc/qa/complex/dataPilot/CheckDataPilot.java @@ -47,10 +47,10 @@ import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.util.XCloseable; -import complex.dataPilot.interfaceTests.beans._XPropertySet; -import complex.dataPilot.interfaceTests.container._XNamed; -import complex.dataPilot.interfaceTests.sheet._XDataPilotDescriptor; -import complex.dataPilot.interfaceTests.sheet._XDataPilotTable; +import complex.dataPilot._XPropertySet; +import complex.dataPilot._XNamed; +import complex.dataPilot._XDataPilotDescriptor; +import complex.dataPilot._XDataPilotTable; // import complexlib.ComplexTestCase; import lib.StatusException; import lib.TestParameters; diff --git a/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java new file mode 100644 index 000000000000..e611d8f4e147 --- /dev/null +++ b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java @@ -0,0 +1,464 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.dataPilot; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XNamed; +import com.sun.star.sheet.DataPilotFieldOrientation; +import com.sun.star.sheet.XDataPilotDescriptor; +import com.sun.star.table.CellRangeAddress; +import com.sun.star.uno.UnoRuntime; +// import lib.MultiMethodTest; +// import lib.Status; +//import lib.StatusException; +import lib.TestParameters; +// import share.LogWriter; + +/** +* Testing com.sun.star.sheet.XDataPilotDescriptor +* interface methods : +*
          +*
        • getTag()
        • +*
        • setTag()
        • +*
        • getSourceRange()
        • +*
        • setSourceRange()
        • +*
        • getFilterDescriptor()
        • +*
        • getDataPilotFields()
        • +*
        • getColumnFields()
        • +*
        • getRowFields()
        • +*
        • getPageFields()
        • +*
        • getDataFields()
        • +*
        • getHiddenFields()
        • +*

        +* This test needs the following object relations : +*

          +*
        • 'FIELDSAMOUNT' (of type Integer): +* to have number of fields
        • +*

            +* @see com.sun.star.sheet.XDataPilotDescriptor +*/ +public class _XDataPilotDescriptor { + + public XDataPilotDescriptor oObj = null; + CellRangeAddress CRA = new CellRangeAddress((short)1, 0, 0, 5, 5); + CellRangeAddress oldCRA = null ; + String sTag = new String ("XDataPilotDescriptor_Tag"); + String fieldsNames[]; + int fieldsAmount = 0; + int tEnvFieldsAmount = 0; + + /** + * The test parameters + */ + private TestParameters param = null; + + /** + * The log writer + */ +// private LogWriter log = null; + + /** + * Constructor: gets the object to test, a logger and the test parameters + * @param xObj The test object + * @param param The test parameters + */ + public _XDataPilotDescriptor(XDataPilotDescriptor xObj/*, + LogWriter log*/, TestParameters param) { + oObj = xObj; + // this.log = log; + this.param = param; + } + + /** + * Retrieves object relations. + + * @return + */ + public boolean before() { + Integer amount = (Integer)param.get("FIELDSAMOUNT"); + if (amount == null) { + System.out.println("Relation 'FIELDSAMOUNT' not found"); + return false; + } + tEnvFieldsAmount = amount.intValue(); + return true; + } + + /** + * Test calls the method and compares returned value with value that was set + * in method setSourceRange().

            + * Has OK status if all fields of cell range addresses are equal.

            + * The following method tests are to be completed successfully before : + *

              + *
            • setSourceRange() : to have current source range
            • + *
            + * @return + */ + public boolean _getSourceRange(){ +// requiredMethod("setSourceRange()"); + boolean bResult = true; + + CellRangeAddress objRA = oObj.getSourceRange(); + bResult &= objRA.Sheet == CRA.Sheet; + bResult &= objRA.StartRow == CRA.StartRow; + bResult &= objRA.StartColumn == CRA.StartColumn; + bResult &= objRA.EndRow == CRA.EndRow; + bResult &= objRA.EndColumn == CRA.EndColumn; + + return bResult; + } + + /** + * Test gets the current source range, stores it and sets new source range.

            + * Has OK status if the method successfully returns.

            + * The following method tests are to be executed before : + *

              + *
            • getColumnFields()
            • + *
            • getRowFields()
            • + *
            • getDataFields()
            • + *
            • getHiddenFields()
            • + *
            • getPageFields()
            • + *
            + * @return + */ + public boolean _setSourceRange(){ +/* executeMethod("getColumnFields()") ; + executeMethod("getRowFields()") ; + executeMethod("getDataFields()") ; + executeMethod("getHiddenFields()") ; + executeMethod("getPageFields()") ; */ + + oldCRA = oObj.getSourceRange() ; + oObj.setSourceRange(CRA); + + return true; + } + + /** + * Test calls the method and checks returned value with value that was set + * by method setTag().

            + * Has OK status if returned value is equal to value that was set + * by method setTag().

            + * The following method tests are to be completed successfully before : + *

              + *
            • setTag() : to have current tag
            • + *
            + * @return + */ + public boolean _getTag(){ +// requiredMethod("setTag()"); + boolean bResult = true; + + String objTag = oObj.getTag(); + bResult &= objTag.equals(sTag); + + return bResult; + } + + /** + * Test just calls the method.

            + * Has OK status if the method successfully returns.

            + * @return + */ + public boolean _setTag(){ + oObj.setTag(sTag); + return true; + } + + /** + * Test calls the method , checks returned value, compares + * number of fields goten from returned value and obtained by object + * relation 'FIELDSAMOUNT' and set property + * Orientation to one of DataPilotFieldOrientation values.

            + * Has OK status if returned value isn't null, number of fields + * goten from returned value is less than number of fields obtained by relation + * and no exceptions were thrown.

            + * @return + */ + public boolean _getDataPilotFields(){ + boolean bResult = true; + XIndexAccess IA = null; + + IA = oObj.getDataPilotFields(); + if (IA == null) { + System.out.println("Returned value is null."); + return false; + } else {System.out.println("getDataPilotFields returned not Null value -- OK");} + + fieldsAmount = IA.getCount(); + if (fieldsAmount < tEnvFieldsAmount) { + System.out.println("Number of fields is less than number goten by relation."); + return false; + } else {System.out.println("count of returned fields -- OK");} + + fieldsNames = new String[tEnvFieldsAmount]; + int i = -1 ; + int cnt = 0 ; + while (++i < fieldsAmount) { + Object field; + try { + field = IA.getByIndex(i); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(); + return false; + } catch(com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(); + return false; + } + + XNamed named = UnoRuntime.queryInterface(XNamed.class, field); + String name = named.getName(); + + System.out.println("Field : '" + name + "' ... ") ; + + if (!name.equals("Data")) { + + fieldsNames[cnt] = name ; + + XPropertySet props = + UnoRuntime.queryInterface(XPropertySet.class, field); + + try { + switch (cnt % 5) { + case 0 : + props.setPropertyValue("Orientation", + DataPilotFieldOrientation.COLUMN); + System.out.println(" Column") ; + break; + case 1 : + props.setPropertyValue("Orientation", + DataPilotFieldOrientation.ROW); + System.out.println(" Row") ; + break; + case 2 : + props.setPropertyValue("Orientation", + DataPilotFieldOrientation.DATA); + System.out.println(" Data") ; + break; + case 3 : + props.setPropertyValue("Orientation", + DataPilotFieldOrientation.HIDDEN); + System.out.println(" Hidden") ; + break; + case 4 : + props.setPropertyValue("Orientation", + DataPilotFieldOrientation.PAGE); + System.out.println(" Page") ; + props.setPropertyValue("CurrentPage", "20"); + break; + } } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(); + return false; + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(); + return false; + } catch (com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(); + return false; + } catch (com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(); + return false; + } + if (++cnt > 4) + { + break; + } + } + else + { + return false; + } + } + + return bResult; + } + + /** + * Test calls the method and checks returned collection using the method + * CheckNames().

            + * Has OK status if the method CheckNames() returns true + * and no exceptions were thrown.

            + * The following method tests are to be completed successfully before : + *

              + *
            • getDataPilotFields() : to have array of field names
            • + *
            + * @return + */ + public boolean _getColumnFields(){ +// requiredMethod("getDataPilotFields()"); + System.out.println("getColumnFields") ; + XIndexAccess IA = oObj.getColumnFields(); + return CheckNames(IA, 0); + } + + /** + * Test calls the method and checks returned collection using the method + * CheckNames().

            + * Has OK status if the method CheckNames() returned true + * and no exceptions were thrown.

            + * The following method tests are to be completed successfully before : + *

              + *
            • getDataPilotFields() : to have array of field names
            • + *
            + * @return + */ + public boolean _getDataFields(){ +// requiredMethod("getDataPilotFields()"); + System.out.println("getDataFields") ; + XIndexAccess IA = oObj.getDataFields(); + return CheckNames(IA, 2); + } + + /** + * Test calls the method and checks returned collection using the method + * CheckNames().

            + * Has OK status if the method CheckNames() returned true + * and no exceptions were thrown.

            + * The following method tests are to be completed successfully before : + *

              + *
            • getDataPilotFields() : to have array of field names
            • + *
            + * @return + */ + public boolean _getHiddenFields(){ +// requiredMethod("getDataPilotFields()"); + System.out.println("getHiddenFields") ; + XIndexAccess IA = oObj.getHiddenFields(); + return CheckNames(IA, 3); + } + + /** + * Test calls the method and checks returned collection using the method + * CheckNames().

            + * Has OK status if the method CheckNames() returned true + * and no exceptions were thrown.

            + * The following method tests are to be completed successfully before : + *

              + *
            • getDataPilotFields() : to have array of field names
            • + *
            + * @return + */ + public boolean _getRowFields(){ +// requiredMethod("getDataPilotFields()"); + System.out.println("getRowFields") ; + XIndexAccess IA = oObj.getRowFields(); + boolean bResult = CheckNames(IA, 1); + return bResult; + } + + /** + * setting of PageFields isn't supported by StarOffice Calc + * Has OK status if the returned IndexAccess + * isn't NULL.

            + * The following method tests are to be completed successfully before : + *

              + *
            • getDataPilotFields() : to have array of field names
            • + *
            + * @return + */ + public boolean _getPageFields(){ +// requiredMethod("getDataPilotFields()"); + System.out.println("getPageFields") ; + XIndexAccess IA = oObj.getPageFields(); + boolean bResult = CheckNames(IA, 4); + return bResult; + } + + /** + * Test calls the method and checks returned value.

            + * Has OK status if returned value isn't null + * and no exceptions were thrown.

            + * @return + */ + public boolean _getFilterDescriptor(){ + boolean bResult = oObj.getFilterDescriptor() != null; + return bResult; + } + + /** + * Method checks that the field with index rem exists + * in the array IA. + * @param IA collection of elements that support interface XNamed + * @param rem index of field in the array of field names that was stored in + * the method getDataPilotFields() + * @return true if required field name exists in passed collection; + * false otherwise + * @see com.sun.star.container.XNamed + */ + private boolean CheckNames(XIndexAccess IA, int rem) { + String name = null; + + if (IA == null) { + System.out.println("Null retruned.") ; + return false ; + } + + if (fieldsNames[rem] == null) { + System.out.println("No fields were set to this orientation - cann't check result") ; + return true ; + } + + if (IA.getCount() == 0) { + System.out.println("No fields found. Must be at least '" + + fieldsNames[rem] + "'") ; + return false ; + } + + try { + System.out.println("Fields returned ") ; + for (int i = 0; i < IA.getCount(); i++) { + Object field = IA.getByIndex(i); + XNamed named = UnoRuntime.queryInterface + (XNamed.class, field); + name = named.getName(); + System.out.println(" " + name) ; + if (fieldsNames[rem].equals(name)) { + System.out.println(" - OK") ; + return true ; + } + } + } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(); + return false ; + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(); + return false ; + } + System.out.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; + return false ; + } + + /** + * Recreates object(to back old orientations of the fields). + * + protected void after() { + disposeEnvironment(); + }*/ +} + diff --git a/sc/qa/complex/dataPilot/_XDataPilotTable.java b/sc/qa/complex/dataPilot/_XDataPilotTable.java new file mode 100644 index 000000000000..e27daffab985 --- /dev/null +++ b/sc/qa/complex/dataPilot/_XDataPilotTable.java @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.dataPilot; + +import com.sun.star.sheet.XDataPilotTable; +import com.sun.star.table.CellAddress; +import com.sun.star.table.CellRangeAddress; +import com.sun.star.table.XCell; +// import lib.Status; +//import lib.StatusException; +import lib.TestParameters; +// import share.LogWriter; + +/** +* Testing com.sun.star.sheet.XDataPilotTable +* interface methods : +*

              +*
            • getOutputRange()
            • +*
            • refresh()
            • +*

            +* This test needs the following object relations : +*

              +*
            • 'OUTPUTRANGE' (of type CellAddress): +* to check value returned by method getOutputRange()
            • +*
            • 'CELLFORCHANGE' (of type XCell): +* to check the method refresh(value of this cell will be changed)
            • +*
            • 'CELLFORCHECK' (of type XCell): +* to check the method refresh (value of this cell must be changed after refresh +* call)
              • +* @see com.sun.star.sheet.XDataPilotTable +* @see com.sun.star.table.CellAddress +*/ +public class _XDataPilotTable { + + public XDataPilotTable oObj = null; + XCell xCellForChange = null; + XCell xCellForCheck = null; + CellAddress OutputRange = null; + int changeValue = 0; + + /** + * The test parameters + */ + private TestParameters param = null; + + /** + * The log writer + */ + // private LogWriter log = null; + + /** + * Constructor: gets the object to test, a logger and the test parameters + * @param xObj The test object + + * @param param The test parameters + */ + public _XDataPilotTable(XDataPilotTable xObj/*, + LogWriter log*/, TestParameters param) { + oObj = xObj; + // this.log = log; + this.param = param; + } + + public boolean before() { + xCellForChange = (XCell)param.get("CELLFORCHANGE"); + xCellForCheck = (XCell)param.get("CELLFORCHECK"); + OutputRange = (CellAddress)param.get("OUTPUTRANGE"); + changeValue = ((Integer)param.get("CHANGEVALUE")).intValue(); + + if (xCellForChange == null || OutputRange == null || + xCellForCheck == null) { + System.out.println("Relation not found"); + return false; + } + return true; + } + /** + * Test calls the method and checks returned value using value obtained by + * object relation 'OUTPUTRANGE'.

                + * Has OK status if values are equal.

                + * @return + */ + public boolean _getOutputRange(){ + boolean bResult = true; + CellRangeAddress objRange = oObj.getOutputRange(); + bResult &= OutputRange.Sheet == objRange.Sheet; + bResult &= OutputRange.Row == objRange.StartRow; + bResult &= OutputRange.Column == objRange.StartColumn; + return bResult; + } + + /** + * Test sets new value of the cell obtained by object relation + * 'CELLFORCHANGE', and checks value of the cell obtained by object + * relation 'CELLFORCHECK'.

                + * Has OK status if value of the cell obtained by object relation + * 'CELLFORCHECK' is changed.

                + * @return + */ + public boolean _refresh(){ + xCellForChange.setValue(changeValue); + double oldData = xCellForCheck.getValue(); + oObj.refresh(); + double newData = xCellForCheck.getValue(); + System.out.println("Old data:" + oldData + "; new data:" + newData); + + return oldData != newData; + } +} + diff --git a/sc/qa/complex/dataPilot/_XNamed.java b/sc/qa/complex/dataPilot/_XNamed.java new file mode 100644 index 000000000000..ff4c647307d5 --- /dev/null +++ b/sc/qa/complex/dataPilot/_XNamed.java @@ -0,0 +1,159 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.dataPilot; + +import com.sun.star.container.XNamed; +import lib.TestParameters; +// import share.LogWriter; +// import util.utils; + +/** +* Testing com.sun.star.container.XNamed +* interface methods : +*

                  +*
                • getName()
                • +*
                • setName()
                • +*
                +* This test need the following object relations : +*
                  +*
                • 'setName' : of Boolean +* type. If it exists then setName method +* isn't to be tested and result of this test will be +* equal to relation value.
                • +*

                    +* Test is NOT multithread compilant.

                    +* @see com.sun.star.container.XNamed +*/ +public class _XNamed { + + /** + * The object that is testsed. + */ + public XNamed oObj = null; + + /** + * The test parameters + */ + private TestParameters param = null; + + /** + * The log writer + */ + // private LogWriter log = null; + + /** + * Constructor: gets the object to test, a logger and the test parameters + * @param xObj The test object + * @param log A log writer + * @param param The test parameters + */ + public _XNamed(XNamed xObj/*, LogWriter log*/, TestParameters param) { + oObj = xObj; + // this.log = log; + this.param = param; + } + + /** + * Test calls the method and checks return value and that + * no exceptions were thrown.

                    + * Has OK status if the method returns non null value + * and no exceptions were thrown.

                    + */ + public boolean _getName() { + + // write to log what we try next + System.out.println( "test for getName()" ); + + boolean result = true; + boolean loc_result = true; + String name = null; + String NewName = null; + + loc_result = ((name = oObj.getName()) != null); + System.out.println("getting the name \"" + name + "\""); + + if (loc_result) + { + System.out.println("... getName() - OK"); + } + else + { + System.out.println("... getName() - FAILED"); + } + result &= loc_result; + return result; + } + + /** + * Sets a new name for object and checks if it was properly + * set. Special cases for the following objects : + *

                      + *
                    • ScSheetLinkObj : name must be in form of URL.
                    • + *
                    • ScDDELinkObj : name must contain link to cell in + * some external Sheet.
                    • + *
                    + * Has OK status if new name was successfully set, or if + * object environment contains relation 'setName' with + * value true.

                    + * The following method tests are to be completed successfully before : + *

                      + *
                    • getName() : to be sure the method works
                    • + *
                    + */ + public boolean _setName(){ +// requiredMethod("getName()"); + System.out.println("testing setName() ... "); + + String oldName = oObj.getName(); + String NewName = oldName == null ? "XNamed" : oldName + "X" ; + + boolean result = true; + boolean loc_result = true; + System.out.println("set the name of object to \"" + NewName + "\""); + oObj.setName(NewName); + System.out.println("check that container has element with this name"); + + String name = oObj.getName(); + System.out.println("getting the name \"" + name + "\""); + loc_result = name.equals(NewName); + + if (loc_result) + { + System.out.println("... setName() - OK"); + } + else + { + System.out.println("... setName() - FAILED"); + } + result &= loc_result; + oObj.setName(oldName); + return result; + } +} + + diff --git a/sc/qa/complex/dataPilot/_XPropertySet.java b/sc/qa/complex/dataPilot/_XPropertySet.java new file mode 100644 index 000000000000..e598a0c28890 --- /dev/null +++ b/sc/qa/complex/dataPilot/_XPropertySet.java @@ -0,0 +1,631 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.dataPilot; + +import com.sun.star.beans.Property; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.PropertyChangeEvent; +import com.sun.star.beans.XPropertyChangeListener; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.beans.XVetoableChangeListener; +import com.sun.star.lang.EventObject; +import java.util.Random; +import java.util.StringTokenizer; +import lib.TestParameters; +// import share.LogWriter; +//import lib.MultiMethodTest; +import util.ValueChanger; +import util.utils; + +/** +* Testing com.sun.star.beans.XPropertySet +* interface methods : +*
                      +*
                    • getPropertySetInfo()
                    • +*
                    • setPropertyValue()
                    • +*
                    • getPropertyValue()
                    • +*
                    • addPropertyChangeListener()
                    • +*
                    • removePropertyChangeListener()
                    • +*
                    • addVetoableChangeListener()
                    • +*
                    • removeVetoableChangeListener()
                    • +*
                    +* @see com.sun.star.beans.XPropertySet +*/ +public class _XPropertySet { + + /** + * The object that is testsed. + */ + private XPropertySet oObj = null; + + /** + * The test parameters + */ + private TestParameters param = null; + + /** + * The log writer + */ + // private LogWriter log = null; + + /** + * Flag that indicates change listener was called. + */ + boolean propertyChanged = false; + + + /** + * The own property change listener + */ + XPropertyChangeListener PClistener = new MyChangeListener(); + + /** + * Listener that must be called on bound property changing. + */ + public class MyChangeListener implements XPropertyChangeListener { + /** + * Just set propertyChanged flag to true. + */ + public void propertyChange(PropertyChangeEvent e) { + propertyChanged = true; + } + public void disposing (EventObject obj) {} + }; + + + /** + * Flag that indicates veto listener was called. + */ + boolean vetoableChanged = false; + + /** + * The own vetoable change listener + */ + XVetoableChangeListener VClistener = new MyVetoListener(); + + /** + * Listener that must be called on constrained property changing. + */ + public class MyVetoListener implements XVetoableChangeListener { + /** + * Just set vetoableChanged flag to true. + */ + public void vetoableChange(PropertyChangeEvent e) { + vetoableChanged = true; + } + public void disposing (EventObject obj) {} + }; + + + /** + * Properties to test + */ + PropsToTest PTT = new PropsToTest(); + + /** + * Structure that collects three properties of each type to test : + * Constrained, Bound and Normal. + */ + public class PropsToTest { + String constrained = null; + String bound = null; + String normal = null; + } + + /** + * Constructor: gets the object to test, a logger and the test parameters + * @param xObj The test object + * @param log A log writer + * @param param The test parameters + */ + public _XPropertySet(XPropertySet xObj/*, LogWriter log*/, TestParameters param) { + oObj = xObj; + // this.log = log; + this.param = param; + } + + /** + * Tests method getPropertySetInfo. After test completed + * call {@link #getPropsToTest} method to retrieve different kinds + * of properties to test then.

                    + * Has OK status if not null XPropertySetInfo + * object returned.

                    + * Since getPropertySetInfo is optional, it may return null, + * if it is not implemented. This method uses then an object relation + * PTT (Properties To Test) to determine available properties. + * All tests for services without getPropertySetInfo must + * provide this object relation. + */ + public boolean _getPropertySetInfo() { + XPropertySetInfo propertySetInfo = oObj.getPropertySetInfo(); + + if (propertySetInfo == null) { + System.out.println("getPropertySetInfo() method returned null"); + String[] ptt = (String[]) param.get("PTT"); + PTT.normal=ptt[0]; + PTT.bound=ptt[1]; + PTT.constrained=ptt[2]; + } else { + getPropsToTest(propertySetInfo); + } + + return true; + + } // end of getPropertySetInfo() + + /** + * Tests change listener which added for bound properties. + * Adds listener to bound property (if it exists), then changes + * its value and check if listener was called.

                    + * Method tests to be successfully completed before : + *

                      + *
                    • getPropertySetInfo : in this method test + * one of bound properties is retrieved.
                    • + *

                    + * Has OK status if NO bound properties exist or if listener + * was successfully called. + */ + public boolean _addPropertyChangeListener() { + + propertyChanged = false; + boolean result = true; + + if ( PTT.bound.equals("none") ) { + System.out.println("*** No bound properties found ***"); + } else { + try { + oObj.addPropertyChangeListener(PTT.bound,PClistener); + Object gValue = oObj.getPropertyValue(PTT.bound); + oObj.setPropertyValue(PTT.bound, + ValueChanger.changePValue(gValue)); + } catch (com.sun.star.beans.PropertyVetoException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.IllegalArgumentException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } // end of try-catch + result = propertyChanged; + if (!propertyChanged) { + System.out.println("propertyChangeListener wasn't called for '"+ + PTT.bound+"'"); + } + } //endif + + return result; + + } // end of addPropertyChangeListener() + + /** + * Tests vetoable listener which added for constrained properties. + * Adds listener to constrained property (if it exists), then changes + * its value and check if listener was called.

                    + * Method tests to be successfully completed before : + *

                      + *
                    • getPropertySetInfo : in this method test + * one of constrained properties is retrieved.
                    • + *

                    + * Has OK status if NO constrained properties exist or if listener + * was successfully called. + */ + public boolean _addVetoableChangeListener() { + +// requiredMethod("getPropertySetInfo()"); + + vetoableChanged = false; + boolean result = true; + + if ( PTT.constrained.equals("none") ) { + System.out.println("*** No constrained properties found ***"); + } else { + try { + oObj.addVetoableChangeListener(PTT.constrained,VClistener); + Object gValue = oObj.getPropertyValue(PTT.constrained); + oObj.setPropertyValue(PTT.constrained, + ValueChanger.changePValue(gValue)); + } catch (com.sun.star.beans.PropertyVetoException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.IllegalArgumentException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } // end of try-catch + result = vetoableChanged; + if (!vetoableChanged) { + System.out.println("vetoableChangeListener wasn't called for '"+ + PTT.constrained+"'"); + } + } //endif + + return result; + + } // end of addVetoableChangeListener() + + + /** + * Tests setPropertyValue method. + * Stores value before call, and compares it with value after + * call.

                    + * Method tests to be successfully completed before : + *

                      + *
                    • getPropertySetInfo : in this method test + * one of normal properties is retrieved.
                    • + *

                    + * Has OK status if NO normal properties exist or if value before + * method call is not equal to value after. + */ + public boolean _setPropertyValue() { + +// requiredMethod("getPropertySetInfo()"); + + Object gValue = null; + Object sValue = null; + + boolean result = true; + + if ( PTT.normal.equals("none") ) { + System.out.println("*** No changeable properties found ***"); + } else { + try { + gValue = oObj.getPropertyValue(PTT.normal); + sValue = ValueChanger.changePValue(gValue); + oObj.setPropertyValue(PTT.normal, sValue); + sValue = oObj.getPropertyValue(PTT.normal); + } catch (com.sun.star.beans.PropertyVetoException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.normal+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.IllegalArgumentException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.normal+"'"); + e.printStackTrace(); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.normal+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.normal+"'"); + e.printStackTrace(); + } // end of try-catch + result = !gValue.equals(sValue); + } //endif + + return result; + + } // end of setPropertyValue() + + /** + * Tests getPropertyValue method. + * Just call this method and checks for no exceptions

                    + * Method tests to be successfully completed before : + *

                      + *
                    • getPropertySetInfo : in this method test + * one of normal properties is retrieved.
                    • + *

                    + * Has OK status if NO normal properties exist or if no + * exceptions were thrown. + */ + public boolean _getPropertyValue() { + +// requiredMethod("getPropertySetInfo()"); + + boolean result = true; + String toCheck = PTT.normal; + + if ( PTT.normal.equals("none") ) { + toCheck = oObj.getPropertySetInfo().getProperties()[0].Name; + System.out.println("All properties are Read Only"); + System.out.println("Using: "+toCheck); + } + + try { + Object gValue = oObj.getPropertyValue(toCheck); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to get property '"+ + PTT.normal+"'"); + e.printStackTrace(); + result = false; + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to get property '"+ + PTT.normal+"'"); + e.printStackTrace(); + result = false; + } // end of try-catch + + return result; + } + + /** + * Tests removePropertyChangeListener method. + * Removes change listener, then changes bound property value + * and checks if the listener was NOT called. + * Method tests to be successfully completed before : + *

                      + *
                    • addPropertyChangeListener : here listener + * was added.
                    • + *

                    + * Has OK status if NO bound properties exist or if listener + * was not called and no exceptions arose. + */ + public boolean _removePropertyChangeListener() { + +// requiredMethod("addPropertyChangeListener()"); + + propertyChanged = false; + boolean result = true; + + if ( PTT.bound.equals("none") ) { + System.out.println("*** No bound properties found ***"); + } else { + try { + propertyChanged = false; + oObj.removePropertyChangeListener(PTT.bound,PClistener); + Object gValue = oObj.getPropertyValue(PTT.bound); + oObj.setPropertyValue(PTT.bound, + ValueChanger.changePValue(gValue)); + } catch (com.sun.star.beans.PropertyVetoException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.IllegalArgumentException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.bound+"'"); + e.printStackTrace(); + } // end of try-catch + + result = !propertyChanged; + if (propertyChanged) { + System.out.println("propertyChangeListener was called after removing"+ + " for '"+PTT.bound+"'"); + } + } //endif + + return result; + + } // end of removePropertyChangeListener() + + + /** + * Tests removeVetoableChangeListener method. + * Removes vetoable listener, then changes constrained property value + * and checks if the listener was NOT called. + * Method tests to be successfully completed before : + *

                      + *
                    • addPropertyChangeListener : here vetoable listener + * was added.
                    • + *

                    + * Has OK status if NO constrained properties exist or if listener + * was NOT called and no exceptions arose. + */ + public boolean _removeVetoableChangeListener() { + +// requiredMethod("addVetoableChangeListener()"); + + vetoableChanged = false; + boolean result = true; + + if ( PTT.constrained.equals("none") ) { + System.out.println("*** No constrained properties found ***"); + } else { + try { + oObj.removeVetoableChangeListener(PTT.constrained,VClistener); + Object gValue = oObj.getPropertyValue(PTT.constrained); + oObj.setPropertyValue(PTT.constrained, + ValueChanger.changePValue(gValue)); + } catch (com.sun.star.beans.PropertyVetoException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.IllegalArgumentException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.beans.UnknownPropertyException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + System.out.println("Exception occured while trying to change "+ + "property '"+ PTT.constrained+"'"); + e.printStackTrace(); + } // end of try-catch + + result = !vetoableChanged; + if (vetoableChanged) { + System.out.println("vetoableChangeListener was called after "+ + "removing for '"+PTT.constrained+"'"); + } + } //endif + + return result; + + } // end of removeVetoableChangeListener() + + + /** + * Gets the properties being tested. Searches and stores by one + * property of each kind (Bound, Vetoable, Normal). + */ + public PropsToTest getPropsToTest(XPropertySetInfo xPSI) { + + Property[] properties = xPSI.getProperties(); + String bound = ""; + String constrained = ""; + String normal = ""; + + for (int i = 0; i < properties.length; i++) { + + Property property = properties[i]; + String name = property.Name; + System.out.println("Checking '"+name+"'"); + boolean isWritable = ((property.Attributes & + PropertyAttribute.READONLY) == 0); + boolean isNotNull = ((property.Attributes & + PropertyAttribute.MAYBEVOID) == 0); + boolean isBound = ((property.Attributes & + PropertyAttribute.BOUND) != 0); + boolean isConstr = ((property.Attributes & + PropertyAttribute.CONSTRAINED) != 0); + boolean canChange = false; + + if ( !isWritable ) System.out.println("Property '"+name+"' is READONLY"); + + if (name.endsWith("URL")) isWritable = false; + if (name.startsWith("Fill")) isWritable = false; + if (name.startsWith("Font")) isWritable = false; + if (name.startsWith("IsNumbering")) isWritable = false; + if (name.startsWith("LayerName")) isWritable = false; + if (name.startsWith("Line")) isWritable = false; + + //if (name.equals("xinterfaceA") || name.equals("xtypeproviderA") + //|| name.equals("arAnyA")) isWritable=false; + + if ( isWritable && isNotNull ) canChange = isChangeable(name); + + if ( isWritable && isNotNull && isBound && canChange) { + bound+=name+";"; + } + + if ( isWritable && isNotNull && isConstr && canChange) { + constrained+=name+";"; + } + + if ( isWritable && isNotNull && canChange) normal+=name+";"; + + + } // endfor + + //get a random bound property + PTT.bound=getRandomString(bound); + System.out.println("Bound: "+PTT.bound); + + //get a random constrained property + PTT.constrained=getRandomString(constrained); + System.out.println("Constrained: "+PTT.constrained); + + //get a random normal property + PTT.normal=getRandomString(normal); + + return PTT; + + } + + /** + * Retrieves one random property name from list (property names separated + * by ';') of property names. + */ + public String getRandomString(String str) { + + String gRS = "none"; + Random rnd = new Random(); + + if (str.equals("")) str = "none"; + StringTokenizer ST=new StringTokenizer(str,";"); + int nr = rnd.nextInt(ST.countTokens()); + if (nr < 1) nr+=1; + for (int i=1; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.dataPilot.interfaceTests.beans; - -import com.sun.star.beans.Property; -import com.sun.star.beans.PropertyAttribute; -import com.sun.star.beans.PropertyChangeEvent; -import com.sun.star.beans.XPropertyChangeListener; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; -import com.sun.star.beans.XVetoableChangeListener; -import com.sun.star.lang.EventObject; -import java.util.Random; -import java.util.StringTokenizer; -import lib.TestParameters; -// import share.LogWriter; -//import lib.MultiMethodTest; -import util.ValueChanger; -import util.utils; - -/** -* Testing com.sun.star.beans.XPropertySet -* interface methods : -*

                      -*
                    • getPropertySetInfo()
                    • -*
                    • setPropertyValue()
                    • -*
                    • getPropertyValue()
                    • -*
                    • addPropertyChangeListener()
                    • -*
                    • removePropertyChangeListener()
                    • -*
                    • addVetoableChangeListener()
                    • -*
                    • removeVetoableChangeListener()
                    • -*
                    -* @see com.sun.star.beans.XPropertySet -*/ -public class _XPropertySet { - - /** - * The object that is testsed. - */ - private XPropertySet oObj = null; - - /** - * The test parameters - */ - private TestParameters param = null; - - /** - * The log writer - */ - // private LogWriter log = null; - - /** - * Flag that indicates change listener was called. - */ - boolean propertyChanged = false; - - - /** - * The own property change listener - */ - XPropertyChangeListener PClistener = new MyChangeListener(); - - /** - * Listener that must be called on bound property changing. - */ - public class MyChangeListener implements XPropertyChangeListener { - /** - * Just set propertyChanged flag to true. - */ - public void propertyChange(PropertyChangeEvent e) { - propertyChanged = true; - } - public void disposing (EventObject obj) {} - }; - - - /** - * Flag that indicates veto listener was called. - */ - boolean vetoableChanged = false; - - /** - * The own vetoable change listener - */ - XVetoableChangeListener VClistener = new MyVetoListener(); - - /** - * Listener that must be called on constrained property changing. - */ - public class MyVetoListener implements XVetoableChangeListener { - /** - * Just set vetoableChanged flag to true. - */ - public void vetoableChange(PropertyChangeEvent e) { - vetoableChanged = true; - } - public void disposing (EventObject obj) {} - }; - - - /** - * Properties to test - */ - PropsToTest PTT = new PropsToTest(); - - /** - * Structure that collects three properties of each type to test : - * Constrained, Bound and Normal. - */ - public class PropsToTest { - String constrained = null; - String bound = null; - String normal = null; - } - - /** - * Constructor: gets the object to test, a logger and the test parameters - * @param xObj The test object - * @param log A log writer - * @param param The test parameters - */ - public _XPropertySet(XPropertySet xObj/*, LogWriter log*/, TestParameters param) { - oObj = xObj; - // this.log = log; - this.param = param; - } - - /** - * Tests method getPropertySetInfo. After test completed - * call {@link #getPropsToTest} method to retrieve different kinds - * of properties to test then.

                    - * Has OK status if not null XPropertySetInfo - * object returned.

                    - * Since getPropertySetInfo is optional, it may return null, - * if it is not implemented. This method uses then an object relation - * PTT (Properties To Test) to determine available properties. - * All tests for services without getPropertySetInfo must - * provide this object relation. - */ - public boolean _getPropertySetInfo() { - XPropertySetInfo propertySetInfo = oObj.getPropertySetInfo(); - - if (propertySetInfo == null) { - System.out.println("getPropertySetInfo() method returned null"); - String[] ptt = (String[]) param.get("PTT"); - PTT.normal=ptt[0]; - PTT.bound=ptt[1]; - PTT.constrained=ptt[2]; - } else { - getPropsToTest(propertySetInfo); - } - - return true; - - } // end of getPropertySetInfo() - - /** - * Tests change listener which added for bound properties. - * Adds listener to bound property (if it exists), then changes - * its value and check if listener was called.

                    - * Method tests to be successfully completed before : - *

                      - *
                    • getPropertySetInfo : in this method test - * one of bound properties is retrieved.
                    • - *

                    - * Has OK status if NO bound properties exist or if listener - * was successfully called. - */ - public boolean _addPropertyChangeListener() { - - propertyChanged = false; - boolean result = true; - - if ( PTT.bound.equals("none") ) { - System.out.println("*** No bound properties found ***"); - } else { - try { - oObj.addPropertyChangeListener(PTT.bound,PClistener); - Object gValue = oObj.getPropertyValue(PTT.bound); - oObj.setPropertyValue(PTT.bound, - ValueChanger.changePValue(gValue)); - } catch (com.sun.star.beans.PropertyVetoException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } // end of try-catch - result = propertyChanged; - if (!propertyChanged) { - System.out.println("propertyChangeListener wasn't called for '"+ - PTT.bound+"'"); - } - } //endif - - return result; - - } // end of addPropertyChangeListener() - - /** - * Tests vetoable listener which added for constrained properties. - * Adds listener to constrained property (if it exists), then changes - * its value and check if listener was called.

                    - * Method tests to be successfully completed before : - *

                      - *
                    • getPropertySetInfo : in this method test - * one of constrained properties is retrieved.
                    • - *

                    - * Has OK status if NO constrained properties exist or if listener - * was successfully called. - */ - public boolean _addVetoableChangeListener() { - -// requiredMethod("getPropertySetInfo()"); - - vetoableChanged = false; - boolean result = true; - - if ( PTT.constrained.equals("none") ) { - System.out.println("*** No constrained properties found ***"); - } else { - try { - oObj.addVetoableChangeListener(PTT.constrained,VClistener); - Object gValue = oObj.getPropertyValue(PTT.constrained); - oObj.setPropertyValue(PTT.constrained, - ValueChanger.changePValue(gValue)); - } catch (com.sun.star.beans.PropertyVetoException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } // end of try-catch - result = vetoableChanged; - if (!vetoableChanged) { - System.out.println("vetoableChangeListener wasn't called for '"+ - PTT.constrained+"'"); - } - } //endif - - return result; - - } // end of addVetoableChangeListener() - - - /** - * Tests setPropertyValue method. - * Stores value before call, and compares it with value after - * call.

                    - * Method tests to be successfully completed before : - *

                      - *
                    • getPropertySetInfo : in this method test - * one of normal properties is retrieved.
                    • - *

                    - * Has OK status if NO normal properties exist or if value before - * method call is not equal to value after. - */ - public boolean _setPropertyValue() { - -// requiredMethod("getPropertySetInfo()"); - - Object gValue = null; - Object sValue = null; - - boolean result = true; - - if ( PTT.normal.equals("none") ) { - System.out.println("*** No changeable properties found ***"); - } else { - try { - gValue = oObj.getPropertyValue(PTT.normal); - sValue = ValueChanger.changePValue(gValue); - oObj.setPropertyValue(PTT.normal, sValue); - sValue = oObj.getPropertyValue(PTT.normal); - } catch (com.sun.star.beans.PropertyVetoException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.normal+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.normal+"'"); - e.printStackTrace(); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.normal+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.normal+"'"); - e.printStackTrace(); - } // end of try-catch - result = !gValue.equals(sValue); - } //endif - - return result; - - } // end of setPropertyValue() - - /** - * Tests getPropertyValue method. - * Just call this method and checks for no exceptions

                    - * Method tests to be successfully completed before : - *

                      - *
                    • getPropertySetInfo : in this method test - * one of normal properties is retrieved.
                    • - *

                    - * Has OK status if NO normal properties exist or if no - * exceptions were thrown. - */ - public boolean _getPropertyValue() { - -// requiredMethod("getPropertySetInfo()"); - - boolean result = true; - String toCheck = PTT.normal; - - if ( PTT.normal.equals("none") ) { - toCheck = oObj.getPropertySetInfo().getProperties()[0].Name; - System.out.println("All properties are Read Only"); - System.out.println("Using: "+toCheck); - } - - try { - Object gValue = oObj.getPropertyValue(toCheck); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to get property '"+ - PTT.normal+"'"); - e.printStackTrace(); - result = false; - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to get property '"+ - PTT.normal+"'"); - e.printStackTrace(); - result = false; - } // end of try-catch - - return result; - } - - /** - * Tests removePropertyChangeListener method. - * Removes change listener, then changes bound property value - * and checks if the listener was NOT called. - * Method tests to be successfully completed before : - *

                      - *
                    • addPropertyChangeListener : here listener - * was added.
                    • - *

                    - * Has OK status if NO bound properties exist or if listener - * was not called and no exceptions arose. - */ - public boolean _removePropertyChangeListener() { - -// requiredMethod("addPropertyChangeListener()"); - - propertyChanged = false; - boolean result = true; - - if ( PTT.bound.equals("none") ) { - System.out.println("*** No bound properties found ***"); - } else { - try { - propertyChanged = false; - oObj.removePropertyChangeListener(PTT.bound,PClistener); - Object gValue = oObj.getPropertyValue(PTT.bound); - oObj.setPropertyValue(PTT.bound, - ValueChanger.changePValue(gValue)); - } catch (com.sun.star.beans.PropertyVetoException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.bound+"'"); - e.printStackTrace(); - } // end of try-catch - - result = !propertyChanged; - if (propertyChanged) { - System.out.println("propertyChangeListener was called after removing"+ - " for '"+PTT.bound+"'"); - } - } //endif - - return result; - - } // end of removePropertyChangeListener() - - - /** - * Tests removeVetoableChangeListener method. - * Removes vetoable listener, then changes constrained property value - * and checks if the listener was NOT called. - * Method tests to be successfully completed before : - *

                      - *
                    • addPropertyChangeListener : here vetoable listener - * was added.
                    • - *

                    - * Has OK status if NO constrained properties exist or if listener - * was NOT called and no exceptions arose. - */ - public boolean _removeVetoableChangeListener() { - -// requiredMethod("addVetoableChangeListener()"); - - vetoableChanged = false; - boolean result = true; - - if ( PTT.constrained.equals("none") ) { - System.out.println("*** No constrained properties found ***"); - } else { - try { - oObj.removeVetoableChangeListener(PTT.constrained,VClistener); - Object gValue = oObj.getPropertyValue(PTT.constrained); - oObj.setPropertyValue(PTT.constrained, - ValueChanger.changePValue(gValue)); - } catch (com.sun.star.beans.PropertyVetoException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } catch (com.sun.star.lang.WrappedTargetException e) { - System.out.println("Exception occured while trying to change "+ - "property '"+ PTT.constrained+"'"); - e.printStackTrace(); - } // end of try-catch - - result = !vetoableChanged; - if (vetoableChanged) { - System.out.println("vetoableChangeListener was called after "+ - "removing for '"+PTT.constrained+"'"); - } - } //endif - - return result; - - } // end of removeVetoableChangeListener() - - - /** - * Gets the properties being tested. Searches and stores by one - * property of each kind (Bound, Vetoable, Normal). - */ - public PropsToTest getPropsToTest(XPropertySetInfo xPSI) { - - Property[] properties = xPSI.getProperties(); - String bound = ""; - String constrained = ""; - String normal = ""; - - for (int i = 0; i < properties.length; i++) { - - Property property = properties[i]; - String name = property.Name; - System.out.println("Checking '"+name+"'"); - boolean isWritable = ((property.Attributes & - PropertyAttribute.READONLY) == 0); - boolean isNotNull = ((property.Attributes & - PropertyAttribute.MAYBEVOID) == 0); - boolean isBound = ((property.Attributes & - PropertyAttribute.BOUND) != 0); - boolean isConstr = ((property.Attributes & - PropertyAttribute.CONSTRAINED) != 0); - boolean canChange = false; - - if ( !isWritable ) System.out.println("Property '"+name+"' is READONLY"); - - if (name.endsWith("URL")) isWritable = false; - if (name.startsWith("Fill")) isWritable = false; - if (name.startsWith("Font")) isWritable = false; - if (name.startsWith("IsNumbering")) isWritable = false; - if (name.startsWith("LayerName")) isWritable = false; - if (name.startsWith("Line")) isWritable = false; - - //if (name.equals("xinterfaceA") || name.equals("xtypeproviderA") - //|| name.equals("arAnyA")) isWritable=false; - - if ( isWritable && isNotNull ) canChange = isChangeable(name); - - if ( isWritable && isNotNull && isBound && canChange) { - bound+=name+";"; - } - - if ( isWritable && isNotNull && isConstr && canChange) { - constrained+=name+";"; - } - - if ( isWritable && isNotNull && canChange) normal+=name+";"; - - - } // endfor - - //get a random bound property - PTT.bound=getRandomString(bound); - System.out.println("Bound: "+PTT.bound); - - //get a random constrained property - PTT.constrained=getRandomString(constrained); - System.out.println("Constrained: "+PTT.constrained); - - //get a random normal property - PTT.normal=getRandomString(normal); - - return PTT; - - } - - /** - * Retrieves one random property name from list (property names separated - * by ';') of property names. - */ - public String getRandomString(String str) { - - String gRS = "none"; - Random rnd = new Random(); - - if (str.equals("")) str = "none"; - StringTokenizer ST=new StringTokenizer(str,";"); - int nr = rnd.nextInt(ST.countTokens()); - if (nr < 1) nr+=1; - for (int i=1; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.dataPilot.interfaceTests.container; - -import com.sun.star.container.XNamed; -import lib.TestParameters; -// import share.LogWriter; -// import util.utils; - -/** -* Testing com.sun.star.container.XNamed -* interface methods : -*

                      -*
                    • getName()
                    • -*
                    • setName()
                    • -*
                    -* This test need the following object relations : -*
                      -*
                    • 'setName' : of Boolean -* type. If it exists then setName method -* isn't to be tested and result of this test will be -* equal to relation value.
                    • -*

                        -* Test is NOT multithread compilant.

                        -* @see com.sun.star.container.XNamed -*/ -public class _XNamed { - - /** - * The object that is testsed. - */ - public XNamed oObj = null; - - /** - * The test parameters - */ - private TestParameters param = null; - - /** - * The log writer - */ - // private LogWriter log = null; - - /** - * Constructor: gets the object to test, a logger and the test parameters - * @param xObj The test object - * @param log A log writer - * @param param The test parameters - */ - public _XNamed(XNamed xObj/*, LogWriter log*/, TestParameters param) { - oObj = xObj; - // this.log = log; - this.param = param; - } - - /** - * Test calls the method and checks return value and that - * no exceptions were thrown.

                        - * Has OK status if the method returns non null value - * and no exceptions were thrown.

                        - */ - public boolean _getName() { - - // write to log what we try next - System.out.println( "test for getName()" ); - - boolean result = true; - boolean loc_result = true; - String name = null; - String NewName = null; - - loc_result = ((name = oObj.getName()) != null); - System.out.println("getting the name \"" + name + "\""); - - if (loc_result) - { - System.out.println("... getName() - OK"); - } - else - { - System.out.println("... getName() - FAILED"); - } - result &= loc_result; - return result; - } - - /** - * Sets a new name for object and checks if it was properly - * set. Special cases for the following objects : - *

                          - *
                        • ScSheetLinkObj : name must be in form of URL.
                        • - *
                        • ScDDELinkObj : name must contain link to cell in - * some external Sheet.
                        • - *
                        - * Has OK status if new name was successfully set, or if - * object environment contains relation 'setName' with - * value true.

                        - * The following method tests are to be completed successfully before : - *

                          - *
                        • getName() : to be sure the method works
                        • - *
                        - */ - public boolean _setName(){ -// requiredMethod("getName()"); - System.out.println("testing setName() ... "); - - String oldName = oObj.getName(); - String NewName = oldName == null ? "XNamed" : oldName + "X" ; - - boolean result = true; - boolean loc_result = true; - System.out.println("set the name of object to \"" + NewName + "\""); - oObj.setName(NewName); - System.out.println("check that container has element with this name"); - - String name = oObj.getName(); - System.out.println("getting the name \"" + name + "\""); - loc_result = name.equals(NewName); - - if (loc_result) - { - System.out.println("... setName() - OK"); - } - else - { - System.out.println("... setName() - FAILED"); - } - result &= loc_result; - oObj.setName(oldName); - return result; - } -} - - diff --git a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java deleted file mode 100644 index a0cd423fc2a3..000000000000 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java +++ /dev/null @@ -1,464 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.dataPilot.interfaceTests.sheet; - -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XNamed; -import com.sun.star.sheet.DataPilotFieldOrientation; -import com.sun.star.sheet.XDataPilotDescriptor; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.uno.UnoRuntime; -// import lib.MultiMethodTest; -// import lib.Status; -//import lib.StatusException; -import lib.TestParameters; -// import share.LogWriter; - -/** -* Testing com.sun.star.sheet.XDataPilotDescriptor -* interface methods : -*
                          -*
                        • getTag()
                        • -*
                        • setTag()
                        • -*
                        • getSourceRange()
                        • -*
                        • setSourceRange()
                        • -*
                        • getFilterDescriptor()
                        • -*
                        • getDataPilotFields()
                        • -*
                        • getColumnFields()
                        • -*
                        • getRowFields()
                        • -*
                        • getPageFields()
                        • -*
                        • getDataFields()
                        • -*
                        • getHiddenFields()
                        • -*

                        -* This test needs the following object relations : -*

                          -*
                        • 'FIELDSAMOUNT' (of type Integer): -* to have number of fields
                        • -*

                            -* @see com.sun.star.sheet.XDataPilotDescriptor -*/ -public class _XDataPilotDescriptor { - - public XDataPilotDescriptor oObj = null; - CellRangeAddress CRA = new CellRangeAddress((short)1, 0, 0, 5, 5); - CellRangeAddress oldCRA = null ; - String sTag = new String ("XDataPilotDescriptor_Tag"); - String fieldsNames[]; - int fieldsAmount = 0; - int tEnvFieldsAmount = 0; - - /** - * The test parameters - */ - private TestParameters param = null; - - /** - * The log writer - */ -// private LogWriter log = null; - - /** - * Constructor: gets the object to test, a logger and the test parameters - * @param xObj The test object - * @param param The test parameters - */ - public _XDataPilotDescriptor(XDataPilotDescriptor xObj/*, - LogWriter log*/, TestParameters param) { - oObj = xObj; - // this.log = log; - this.param = param; - } - - /** - * Retrieves object relations. - - * @return - */ - public boolean before() { - Integer amount = (Integer)param.get("FIELDSAMOUNT"); - if (amount == null) { - System.out.println("Relation 'FIELDSAMOUNT' not found"); - return false; - } - tEnvFieldsAmount = amount.intValue(); - return true; - } - - /** - * Test calls the method and compares returned value with value that was set - * in method setSourceRange().

                            - * Has OK status if all fields of cell range addresses are equal.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • setSourceRange() : to have current source range
                            • - *
                            - * @return - */ - public boolean _getSourceRange(){ -// requiredMethod("setSourceRange()"); - boolean bResult = true; - - CellRangeAddress objRA = oObj.getSourceRange(); - bResult &= objRA.Sheet == CRA.Sheet; - bResult &= objRA.StartRow == CRA.StartRow; - bResult &= objRA.StartColumn == CRA.StartColumn; - bResult &= objRA.EndRow == CRA.EndRow; - bResult &= objRA.EndColumn == CRA.EndColumn; - - return bResult; - } - - /** - * Test gets the current source range, stores it and sets new source range.

                            - * Has OK status if the method successfully returns.

                            - * The following method tests are to be executed before : - *

                              - *
                            • getColumnFields()
                            • - *
                            • getRowFields()
                            • - *
                            • getDataFields()
                            • - *
                            • getHiddenFields()
                            • - *
                            • getPageFields()
                            • - *
                            - * @return - */ - public boolean _setSourceRange(){ -/* executeMethod("getColumnFields()") ; - executeMethod("getRowFields()") ; - executeMethod("getDataFields()") ; - executeMethod("getHiddenFields()") ; - executeMethod("getPageFields()") ; */ - - oldCRA = oObj.getSourceRange() ; - oObj.setSourceRange(CRA); - - return true; - } - - /** - * Test calls the method and checks returned value with value that was set - * by method setTag().

                            - * Has OK status if returned value is equal to value that was set - * by method setTag().

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • setTag() : to have current tag
                            • - *
                            - * @return - */ - public boolean _getTag(){ -// requiredMethod("setTag()"); - boolean bResult = true; - - String objTag = oObj.getTag(); - bResult &= objTag.equals(sTag); - - return bResult; - } - - /** - * Test just calls the method.

                            - * Has OK status if the method successfully returns.

                            - * @return - */ - public boolean _setTag(){ - oObj.setTag(sTag); - return true; - } - - /** - * Test calls the method , checks returned value, compares - * number of fields goten from returned value and obtained by object - * relation 'FIELDSAMOUNT' and set property - * Orientation to one of DataPilotFieldOrientation values.

                            - * Has OK status if returned value isn't null, number of fields - * goten from returned value is less than number of fields obtained by relation - * and no exceptions were thrown.

                            - * @return - */ - public boolean _getDataPilotFields(){ - boolean bResult = true; - XIndexAccess IA = null; - - IA = oObj.getDataPilotFields(); - if (IA == null) { - System.out.println("Returned value is null."); - return false; - } else {System.out.println("getDataPilotFields returned not Null value -- OK");} - - fieldsAmount = IA.getCount(); - if (fieldsAmount < tEnvFieldsAmount) { - System.out.println("Number of fields is less than number goten by relation."); - return false; - } else {System.out.println("count of returned fields -- OK");} - - fieldsNames = new String[tEnvFieldsAmount]; - int i = -1 ; - int cnt = 0 ; - while (++i < fieldsAmount) { - Object field; - try { - field = IA.getByIndex(i); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - return false; - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - return false; - } - - XNamed named = UnoRuntime.queryInterface(XNamed.class, field); - String name = named.getName(); - - System.out.println("Field : '" + name + "' ... ") ; - - if (!name.equals("Data")) { - - fieldsNames[cnt] = name ; - - XPropertySet props = - UnoRuntime.queryInterface(XPropertySet.class, field); - - try { - switch (cnt % 5) { - case 0 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.COLUMN); - System.out.println(" Column") ; - break; - case 1 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.ROW); - System.out.println(" Row") ; - break; - case 2 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.DATA); - System.out.println(" Data") ; - break; - case 3 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.HIDDEN); - System.out.println(" Hidden") ; - break; - case 4 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.PAGE); - System.out.println(" Page") ; - props.setPropertyValue("CurrentPage", "20"); - break; - } } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - return false; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - return false; - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(); - return false; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(); - return false; - } - if (++cnt > 4) - { - break; - } - } - else - { - return false; - } - } - - return bResult; - } - - /** - * Test calls the method and checks returned collection using the method - * CheckNames().

                            - * Has OK status if the method CheckNames() returns true - * and no exceptions were thrown.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • getDataPilotFields() : to have array of field names
                            • - *
                            - * @return - */ - public boolean _getColumnFields(){ -// requiredMethod("getDataPilotFields()"); - System.out.println("getColumnFields") ; - XIndexAccess IA = oObj.getColumnFields(); - return CheckNames(IA, 0); - } - - /** - * Test calls the method and checks returned collection using the method - * CheckNames().

                            - * Has OK status if the method CheckNames() returned true - * and no exceptions were thrown.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • getDataPilotFields() : to have array of field names
                            • - *
                            - * @return - */ - public boolean _getDataFields(){ -// requiredMethod("getDataPilotFields()"); - System.out.println("getDataFields") ; - XIndexAccess IA = oObj.getDataFields(); - return CheckNames(IA, 2); - } - - /** - * Test calls the method and checks returned collection using the method - * CheckNames().

                            - * Has OK status if the method CheckNames() returned true - * and no exceptions were thrown.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • getDataPilotFields() : to have array of field names
                            • - *
                            - * @return - */ - public boolean _getHiddenFields(){ -// requiredMethod("getDataPilotFields()"); - System.out.println("getHiddenFields") ; - XIndexAccess IA = oObj.getHiddenFields(); - return CheckNames(IA, 3); - } - - /** - * Test calls the method and checks returned collection using the method - * CheckNames().

                            - * Has OK status if the method CheckNames() returned true - * and no exceptions were thrown.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • getDataPilotFields() : to have array of field names
                            • - *
                            - * @return - */ - public boolean _getRowFields(){ -// requiredMethod("getDataPilotFields()"); - System.out.println("getRowFields") ; - XIndexAccess IA = oObj.getRowFields(); - boolean bResult = CheckNames(IA, 1); - return bResult; - } - - /** - * setting of PageFields isn't supported by StarOffice Calc - * Has OK status if the returned IndexAccess - * isn't NULL.

                            - * The following method tests are to be completed successfully before : - *

                              - *
                            • getDataPilotFields() : to have array of field names
                            • - *
                            - * @return - */ - public boolean _getPageFields(){ -// requiredMethod("getDataPilotFields()"); - System.out.println("getPageFields") ; - XIndexAccess IA = oObj.getPageFields(); - boolean bResult = CheckNames(IA, 4); - return bResult; - } - - /** - * Test calls the method and checks returned value.

                            - * Has OK status if returned value isn't null - * and no exceptions were thrown.

                            - * @return - */ - public boolean _getFilterDescriptor(){ - boolean bResult = oObj.getFilterDescriptor() != null; - return bResult; - } - - /** - * Method checks that the field with index rem exists - * in the array IA. - * @param IA collection of elements that support interface XNamed - * @param rem index of field in the array of field names that was stored in - * the method getDataPilotFields() - * @return true if required field name exists in passed collection; - * false otherwise - * @see com.sun.star.container.XNamed - */ - private boolean CheckNames(XIndexAccess IA, int rem) { - String name = null; - - if (IA == null) { - System.out.println("Null retruned.") ; - return false ; - } - - if (fieldsNames[rem] == null) { - System.out.println("No fields were set to this orientation - cann't check result") ; - return true ; - } - - if (IA.getCount() == 0) { - System.out.println("No fields found. Must be at least '" - + fieldsNames[rem] + "'") ; - return false ; - } - - try { - System.out.println("Fields returned ") ; - for (int i = 0; i < IA.getCount(); i++) { - Object field = IA.getByIndex(i); - XNamed named = UnoRuntime.queryInterface - (XNamed.class, field); - name = named.getName(); - System.out.println(" " + name) ; - if (fieldsNames[rem].equals(name)) { - System.out.println(" - OK") ; - return true ; - } - } - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - return false ; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - return false ; - } - System.out.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; - return false ; - } - - /** - * Recreates object(to back old orientations of the fields). - * - protected void after() { - disposeEnvironment(); - }*/ -} - diff --git a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java b/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java deleted file mode 100644 index 29c6274ef7a8..000000000000 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.dataPilot.interfaceTests.sheet; - -import com.sun.star.sheet.XDataPilotTable; -import com.sun.star.table.CellAddress; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.table.XCell; -// import lib.Status; -//import lib.StatusException; -import lib.TestParameters; -// import share.LogWriter; - -/** -* Testing com.sun.star.sheet.XDataPilotTable -* interface methods : -*

                              -*
                            • getOutputRange()
                            • -*
                            • refresh()
                            • -*

                            -* This test needs the following object relations : -*

                              -*
                            • 'OUTPUTRANGE' (of type CellAddress): -* to check value returned by method getOutputRange()
                            • -*
                            • 'CELLFORCHANGE' (of type XCell): -* to check the method refresh(value of this cell will be changed)
                            • -*
                            • 'CELLFORCHECK' (of type XCell): -* to check the method refresh (value of this cell must be changed after refresh -* call)
                              • -* @see com.sun.star.sheet.XDataPilotTable -* @see com.sun.star.table.CellAddress -*/ -public class _XDataPilotTable { - - public XDataPilotTable oObj = null; - XCell xCellForChange = null; - XCell xCellForCheck = null; - CellAddress OutputRange = null; - int changeValue = 0; - - /** - * The test parameters - */ - private TestParameters param = null; - - /** - * The log writer - */ - // private LogWriter log = null; - - /** - * Constructor: gets the object to test, a logger and the test parameters - * @param xObj The test object - - * @param param The test parameters - */ - public _XDataPilotTable(XDataPilotTable xObj/*, - LogWriter log*/, TestParameters param) { - oObj = xObj; - // this.log = log; - this.param = param; - } - - public boolean before() { - xCellForChange = (XCell)param.get("CELLFORCHANGE"); - xCellForCheck = (XCell)param.get("CELLFORCHECK"); - OutputRange = (CellAddress)param.get("OUTPUTRANGE"); - changeValue = ((Integer)param.get("CHANGEVALUE")).intValue(); - - if (xCellForChange == null || OutputRange == null || - xCellForCheck == null) { - System.out.println("Relation not found"); - return false; - } - return true; - } - /** - * Test calls the method and checks returned value using value obtained by - * object relation 'OUTPUTRANGE'.

                                - * Has OK status if values are equal.

                                - * @return - */ - public boolean _getOutputRange(){ - boolean bResult = true; - CellRangeAddress objRange = oObj.getOutputRange(); - bResult &= OutputRange.Sheet == objRange.Sheet; - bResult &= OutputRange.Row == objRange.StartRow; - bResult &= OutputRange.Column == objRange.StartColumn; - return bResult; - } - - /** - * Test sets new value of the cell obtained by object relation - * 'CELLFORCHANGE', and checks value of the cell obtained by object - * relation 'CELLFORCHECK'.

                                - * Has OK status if value of the cell obtained by object relation - * 'CELLFORCHECK' is changed.

                                - * @return - */ - public boolean _refresh(){ - xCellForChange.setValue(changeValue); - double oldData = xCellForCheck.getValue(); - oObj.refresh(); - double newData = xCellForCheck.getValue(); - System.out.println("Old data:" + oldData + "; new data:" + newData); - - return oldData != newData; - } -} - diff --git a/sc/qa/complex/dataPilot/makefile.mk b/sc/qa/complex/dataPilot/makefile.mk index 2777971e2f5a..85512f8e5bc4 100644 --- a/sc/qa/complex/dataPilot/makefile.mk +++ b/sc/qa/complex/dataPilot/makefile.mk @@ -38,13 +38,15 @@ PACKAGE = complex/dataPilot JAVATESTFILES = \ CheckDataPilot.java -JAVAFILES = $(JAVATESTFILES) +JAVAFILES = $(JAVATESTFILES) \ + _XDataPilotDescriptor.java \ + _XDataPilotTable.java \ + _XNamed.java \ + _XPropertySet.java + JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar EXTRAJARFILES = $(OOO_JUNIT_JAR) -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) -SUBDIRS = interfaceTests/beans interfaceTests/container interfaceTests/sheet - .END .INCLUDE: settings.mk -- cgit v1.2.3 From aea27fdecf6be6eaf12024ac57910a650c88ea64 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 13 Jul 2010 10:04:51 +0200 Subject: sb123: #i113103# disabled chart2/qa/unoapi for now --- chart2/prj/build.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst index 469eb7554d6b..3cdc9a26e3f5 100644 --- a/chart2/prj/build.lst +++ b/chart2/prj/build.lst @@ -24,4 +24,3 @@ ch chart2\source\controller\chartapiwrapper nmake - all ch_source_controlle ch chart2\source\controller\main nmake - all ch_source_controller_main ch_inc NULL ch chart2\source\controller\menus nmake - all ch_source_controller_menus ch_inc NULL ch chart2\prj get - all ch_prj NULL -ch chart2\qa\unoapi nmake - all ch_qa_unoapi NULL -- cgit v1.2.3 From d2c13df2ea23ed334ce37c4fc9687252ff100d51 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 29 Sep 2010 13:31:35 +0200 Subject: sw33bf10: #i105461# write missing parts of OBJLBSDATA sub record --- sc/source/filter/excel/xeescher.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 0509f2afa5fa..b2801df7f54a 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -841,7 +841,7 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm ) } else if( mnObjType == EXC_OBJTYPE_DROPDOWN ) { - rStrm << sal_uInt16( 0 ) << mnLineCount; + rStrm << sal_uInt16( 0 ) << mnLineCount << sal_uInt16( 0 ) << sal_uInt16( 0 ); } rStrm.EndRecord(); -- cgit v1.2.3 From 6d9b321745e617daed8a407b97ee4c1c4a24eaa6 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 6 Oct 2010 17:08:15 +0200 Subject: ooo33gsl10: #i114944# handle AutoFilter button position on RTL sheets --- sc/source/ui/cctrl/dpcontrol.cxx | 22 +++++++++++++++++++--- sc/source/ui/inc/dpcontrol.hxx | 4 +++- sc/source/ui/view/gridwin2.cxx | 17 ++++++++++++++--- sc/source/ui/view/gridwin4.cxx | 13 +++++-------- sc/source/ui/view/output2.cxx | 22 +++++++--------------- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 82c276d98f2c..b90a51ed6bee 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -66,7 +66,8 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt mbBaseButton(true), mbPopupButton(false), mbHasHiddenMember(false), - mbPopupPressed(false) + mbPopupPressed(false), + mbPopupLeft(false) { if (pZoomX) maZoomX = *pZoomX; @@ -88,10 +89,15 @@ void ScDPFieldButton::setText(const OUString& rText) maText = rText; } -void ScDPFieldButton::setBoundingBox(const Point& rPos, const Size& rSize) +void ScDPFieldButton::setBoundingBox(const Point& rPos, const Size& rSize, bool bLayoutRTL) { maPos = rPos; maSize = rSize; + if (bLayoutRTL) + { + // rPos is the logical-left position, adjust maPos to visual-left (inside the cell border) + maPos.X() -= maSize.Width() - 1; + } } void ScDPFieldButton::setDrawBaseButton(bool b) @@ -114,6 +120,11 @@ void ScDPFieldButton::setPopupPressed(bool b) mbPopupPressed = b; } +void ScDPFieldButton::setPopupLeft(bool b) +{ + mbPopupLeft = b; +} + void ScDPFieldButton::draw() { const long nMargin = 2; @@ -179,7 +190,12 @@ void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const if (nH > 18) nH = 18; - rPos.setX(maPos.getX() + maSize.getWidth() - nW); + // #i114944# AutoFilter button is left-aligned in RTL. + // DataPilot button is always right-aligned for now, so text output isn't affected. + if (mbPopupLeft) + rPos.setX(maPos.getX()); + else + rPos.setX(maPos.getX() + maSize.getWidth() - nW); rPos.setY(maPos.getY() + maSize.getHeight() - nH); rSize.setWidth(nW); rSize.setHeight(nH); diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx index 45badf0c88fd..25cb3e05acac 100644 --- a/sc/source/ui/inc/dpcontrol.hxx +++ b/sc/source/ui/inc/dpcontrol.hxx @@ -69,11 +69,12 @@ public: ~ScDPFieldButton(); void setText(const ::rtl::OUString& rText); - void setBoundingBox(const Point& rPos, const Size& rSize); + void setBoundingBox(const Point& rPos, const Size& rSize, bool bLayoutRTL); void setDrawBaseButton(bool b); void setDrawPopupButton(bool b); void setHasHiddenMember(bool b); void setPopupPressed(bool b); + void setPopupLeft(bool b); void draw(); void getPopupBoundingBox(Point& rPos, Size& rSize) const; @@ -94,6 +95,7 @@ private: bool mbPopupButton; bool mbHasHiddenMember; bool mbPopupPressed; + bool mbPopupLeft; }; // ============================================================================ diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index ec584213898c..669f1fda010d 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -145,7 +145,8 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& // Check if the mouse cursor is clicking on the popup arrow box. mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc)); - mpFilterButton->setBoundingBox(aScrPos, aScrSize); + mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL); + mpFilterButton->setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL Point aPopupPos; Size aPopupSize; mpFilterButton->getPopupBoundingBox(aPopupPos, aPopupSize); @@ -371,6 +372,8 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, BOOL bMove ) bool ScGridWindow::DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddress& rPos, ScDPObject* pDPObj) { + BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() ); + // Get the geometry of the cell. Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), eWhich); long nSizeX, nSizeY; @@ -379,7 +382,8 @@ bool ScGridWindow::DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddres // Check if the mouse cursor is clicking on the popup arrow box. ScDPFieldButton aBtn(this, &GetSettings().GetStyleSettings()); - aBtn.setBoundingBox(aScrPos, aScrSize); + aBtn.setBoundingBox(aScrPos, aScrSize, bLayoutRTL); + aBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now Point aPopupPos; Size aPopupSize; aBtn.getPopupBoundingBox(aPopupPos, aPopupSize); @@ -520,9 +524,16 @@ void ScGridWindow::DPLaunchFieldPopupMenu( } } + BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() ); + Rectangle aCellRect(rScrPos, rScrSize); const Size& rPopupSize = mpDPFieldPopup->getWindowSize(); - if (rScrSize.getWidth() > rPopupSize.getWidth()) + if (bLayoutRTL) + { + // RTL: rScrPos is logical-left (visual right) position, always right-align with that + aCellRect.SetPos(Point(rScrPos.X() - rPopupSize.Width() + 1, rScrPos.Y())); + } + else if (rScrSize.getWidth() > rPopupSize.getWidth()) { // If the cell width is larger than the popup window width, launch it // right-aligned with the cell. diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index ba73fbf00269..372dcc582a45 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1291,7 +1291,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2 pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich ); - aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1)); + aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL); + aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL aCellBtn.setDrawBaseButton(false); aCellBtn.setDrawPopupButton(true); aCellBtn.setHasHiddenMember(bArrowState); @@ -1315,17 +1316,13 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2 pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); long nPosX = aScrPos.X(); long nPosY = aScrPos.Y(); - if ( bLayoutRTL ) - { - // overwrite the right, not left (visually) grid as long as the - // left/right colors of the button borders aren't mirrored. - nPosX -= nSizeX - 2; - } + // bLayoutRTL is handled in setBoundingBox String aStr; pDoc->GetString(nCol, nRow, nTab, aStr); aCellBtn.setText(aStr); - aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1)); + aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL); + aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now aCellBtn.setDrawBaseButton(true); aCellBtn.setDrawPopupButton(pInfo->bPopupButton); aCellBtn.setHasHiddenMember(pInfo->bFilterActive); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 6d40d304fb13..61289cc7f931 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -80,7 +80,7 @@ #include //! Autofilter-Breite mit column.cxx zusammenfassen -#define DROPDOWN_BITMAP_SIZE 17 +#define DROPDOWN_BITMAP_SIZE 18 #define DRAWTEXT_MAX 32767 @@ -1274,7 +1274,8 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY ( static_cast(rPattern.GetItem(ATTR_MERGE_FLAG)).GetValue() & SC_MF_AUTO ) && ( !bBreak || pRefDevice == pFmtDevice ) ) { - long nFilter = Min( nMergeSizeY, (long) DROPDOWN_BITMAP_SIZE ); + // filter drop-down width is now independent from row height + const long nFilter = DROPDOWN_BITMAP_SIZE; BOOL bFit = ( nNeeded + nFilter <= nMergeSizeX ); if ( bFit || bCellIsValue ) { @@ -3516,20 +3517,11 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic) eOrient!=SVX_ORIENTATION_STACKED && pInfo && pInfo->bAutoFilter) { - if (pRowInfo[nArrY].nHeight < DROPDOWN_BITMAP_SIZE) - { - if (bPixelToLogic) - nAvailWidth -= pRefDevice->PixelToLogic(Size(0,pRowInfo[nArrY].nHeight)).Height(); - else - nAvailWidth -= pRowInfo[nArrY].nHeight; - } + // filter drop-down width is now independent from row height + if (bPixelToLogic) + nAvailWidth -= pRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height(); else - { - if (bPixelToLogic) - nAvailWidth -= pRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height(); - else - nAvailWidth -= DROPDOWN_BITMAP_SIZE; - } + nAvailWidth -= DROPDOWN_BITMAP_SIZE; long nComp = nEngineWidth; if (nAvailWidth Date: Wed, 13 Oct 2010 13:34:07 +0200 Subject: calc60: #i115025# SetRowHeightRange: compare height directly to mpRowHeights sum value --- sc/source/core/data/table2.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4223c05c4f83..9bb22b68d2ad 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2255,7 +2255,9 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig { if (pDrawLayer) { - unsigned long nOldHeights = GetRowHeight(nStartRow, nEndRow); + // #i115025# When comparing to nNewHeight for the whole range, the height + // including hidden rows has to be used (same behavior as 3.2). + unsigned long nOldHeights = mpRowHeights->getSumValue(nStartRow, nEndRow); // FIXME: should we test for overflows? long nHeightDif = (long) (unsigned long) nNewHeight * (nEndRow - nStartRow + 1) - nOldHeights; -- cgit v1.2.3