diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-10-21 15:10:42 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-10-21 15:10:42 +0200 |
commit | a8d5244b27ad953caf28ed8f071e15ba91d262ee (patch) | |
tree | 8d3f2221a33f173ac304608175c28856422b2a27 | |
parent | 9f4168d8e48f8cd254b9e2edd8a50b1eefcd4b7d (diff) | |
parent | d87a5db7dc45280ede513c2bb90bce7bafc69b8c (diff) |
CWS changehid: resync to m90ooo/DEV300_m91
25 files changed, 1104 insertions, 801 deletions
diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst index 469eb7554..3cdc9a26e 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 diff --git a/sc/prj/build.lst b/sc/prj/build.lst index afdd953d2..08d9f97b2 100755..100644 --- 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 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/calcPreview/TestDocument.java b/sc/qa/complex/calcPreview/TestDocument.java new file mode 100644 index 000000000..a568556e6 --- /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 +* <http://www.openoffice.org/license.html> +* 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("test_documents", name)); + } + + private TestDocument() {} +} diff --git a/sc/qa/complex/calcPreview/ViewForwarder.java b/sc/qa/complex/calcPreview/ViewForwarder.java index 56fa3dc82..3f2b707e0 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 14f942867..864e14976 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 0a48e6584..dfc9e4a39 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: * <ol> @@ -129,15 +173,15 @@ public class CheckXCellRangesQuery extends ComplexTestCase { * <li>query for empty cells</li> * <ol> */ - 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 { * <li>query for an empty cell.</li> * <ol> */ - 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 fc296fe4f..a0beb3839 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 8774bdd7c..26a2ff202 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 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 com.sun.star.util.XCloseable; +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; 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/sheet/_XDataPilotDescriptor.java b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java index d5651b604..2d8267961 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotDescriptor.java +++ b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java @@ -25,7 +25,7 @@ * ************************************************************************/ -package complex.dataPilot.interfaceTests.sheet; +package complex.dataPilot; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; @@ -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 <code>com.sun.star.sheet.XDataPilotDescriptor</code> @@ -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 { * <ul> * <li> <code> setSourceRange() </code> : to have current source range </li> * </ul> - */ + * @return + */ public boolean _getSourceRange(){ // requiredMethod("setSourceRange()"); boolean bResult = true; @@ -144,7 +145,8 @@ public class _XDataPilotDescriptor { * <li> <code> getHiddenFields() </code> </li> * <li> <code> getPageFields() </code> </li> * </ul> - */ + * @return + */ public boolean _setSourceRange(){ /* executeMethod("getColumnFields()") ; executeMethod("getRowFields()") ; @@ -167,7 +169,8 @@ public class _XDataPilotDescriptor { * <ul> * <li> <code> setTag() </code> : to have current tag </li> * </ul> - */ + * @return + */ public boolean _getTag(){ // requiredMethod("setTag()"); boolean bResult = true; @@ -181,7 +184,8 @@ public class _XDataPilotDescriptor { /** * Test just calls the method. <p> * Has <b> OK </b> status if the method successfully returns. <p> - */ + * @return + */ public boolean _setTag(){ oObj.setTag(sTag); return true; @@ -195,22 +199,23 @@ public class _XDataPilotDescriptor { * Has <b> OK </b> 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. <p> - */ + * @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 { * <ul> * <li> <code> getDataPilotFields() </code> : to have array of field names </li> * </ul> - */ + * @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 { * <ul> * <li> <code> getDataPilotFields() </code> : to have array of field names </li> * </ul> - */ + * @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 { * <ul> * <li> <code> getDataPilotFields() </code> : to have array of field names </li> * </ul> - */ + * @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 { * <ul> * <li> <code> getDataPilotFields() </code> : to have array of field names </li> * </ul> - */ + * @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 { * <ul> * <li> <code> getDataPilotFields() </code> : to have array of field names </li> * </ul> - */ + * @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. <p> * Has <b> OK </b> status if returned value isn't null * and no exceptions were thrown. <p> - */ + * @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/_XDataPilotTable.java index 9fa0abf0b..0f164a654 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/sheet/_XDataPilotTable.java +++ b/sc/qa/complex/dataPilot/_XDataPilotTable.java @@ -25,16 +25,16 @@ * ************************************************************************/ -package complex.dataPilot.interfaceTests.sheet; +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.Status; //import lib.StatusException; import lib.TestParameters; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.sheet.XDataPilotTable</code> @@ -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 <code>'OUTPUTRANGE'</code>. <p> * Has <b> OK </b> status if values are equal. <p> - */ + * @return + */ public boolean _getOutputRange(){ boolean bResult = true; CellRangeAddress objRange = oObj.getOutputRange(); @@ -119,13 +120,14 @@ public class _XDataPilotTable { * relation 'CELLFORCHECK'.<p> * Has <b>OK</b> status if value of the cell obtained by object relation * 'CELLFORCHECK' is changed. <p> - */ + * @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/container/_XNamed.java b/sc/qa/complex/dataPilot/_XNamed.java index b38659a97..48433d8c8 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/container/_XNamed.java +++ b/sc/qa/complex/dataPilot/_XNamed.java @@ -25,12 +25,12 @@ * ************************************************************************/ -package complex.dataPilot.interfaceTests.container; +package complex.dataPilot; import com.sun.star.container.XNamed; import lib.TestParameters; -import share.LogWriter; -import util.utils; +// import share.LogWriter; +// import util.utils; /** * Testing <code>com.sun.star.container.XNamed</code> @@ -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/beans/_XPropertySet.java b/sc/qa/complex/dataPilot/_XPropertySet.java index 09e4d7e6e..33dc592af 100644 --- a/sc/qa/complex/dataPilot/interfaceTests/beans/_XPropertySet.java +++ b/sc/qa/complex/dataPilot/_XPropertySet.java @@ -25,7 +25,7 @@ * ************************************************************************/ -package complex.dataPilot.interfaceTests.beans; +package complex.dataPilot; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyAttribute; @@ -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 6ef9f7456..22b29f5e0 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/makefile.mk b/sc/qa/complex/dataPilot/interfaceTests/container/makefile.mk index 675fe7be9..d8b4321f0 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/makefile.mk b/sc/qa/complex/dataPilot/interfaceTests/sheet/makefile.mk index 350e3fcb8..f62d17614 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 a0bf1df34..85512f8e5 100644 --- a/sc/qa/complex/dataPilot/makefile.mk +++ b/sc/qa/complex/dataPilot/makefile.mk @@ -25,34 +25,35 @@ # #************************************************************************* -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) \ + _XDataPilotDescriptor.java \ + _XDataPilotTable.java \ + _XNamed.java \ + _XPropertySet.java -MAXLINELENGTH = 100000 +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -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 fb39b7ca0..a451d4f6c 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 { * <br> * 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<br> @@ -92,26 +101,26 @@ public class CalcRTL extends ComplexTestCase { *<li> TableLayout *</ul> */ - 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 { *<li> VertOrientPosition *</ul> */ - 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 097e6d0c5..e064f9d3b 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 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c4141cce8..765f8316e 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; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 3c771a2f4..a49ec43c2 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(); diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 2b4cdd506..5bc12d7b4 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 f44155a96..6cdcd6c7c 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 1105d9a5a..ef787e049 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 92ed90af3..0c1dc2f47 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 b717f7d99..e26056ba8 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -80,7 +80,7 @@ #include <math.h> //! 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<const ScMergeFlagAttr&>(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<nComp) nAvailWidth=nComp; } |