summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/ifc/table
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/table')
-rw-r--r--qadevOOo/tests/java/ifc/table/_CellProperties.java110
-rw-r--r--qadevOOo/tests/java/ifc/table/_TableColumn.java74
-rw-r--r--qadevOOo/tests/java/ifc/table/_TableRow.java47
-rw-r--r--qadevOOo/tests/java/ifc/table/_XAutoFormattable.java134
-rw-r--r--qadevOOo/tests/java/ifc/table/_XCell.java167
-rw-r--r--qadevOOo/tests/java/ifc/table/_XCellCursor.java247
-rw-r--r--qadevOOo/tests/java/ifc/table/_XCellRange.java151
-rw-r--r--qadevOOo/tests/java/ifc/table/_XColumnRowRange.java66
-rw-r--r--qadevOOo/tests/java/ifc/table/_XTableChart.java125
-rw-r--r--qadevOOo/tests/java/ifc/table/_XTableCharts.java94
-rw-r--r--qadevOOo/tests/java/ifc/table/_XTableChartsSupplier.java60
-rw-r--r--qadevOOo/tests/java/ifc/table/_XTableColumns.java399
-rw-r--r--qadevOOo/tests/java/ifc/table/_XTableRows.java138
13 files changed, 1812 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/table/_CellProperties.java b/qadevOOo/tests/java/ifc/table/_CellProperties.java
new file mode 100644
index 000000000000..99990e5b0339
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_CellProperties.java
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiPropertyTest;
+
+import com.sun.star.container.XNameContainer;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.xml.AttributeData;
+
+/**
+* Testing <code>com.sun.star.table.CellProperties</code>
+* service properties :
+* <ul>
+* <li><code> CellStyle</code></li>
+* <li><code> CellBackColor</code></li>
+* <li><code> IsCellBackgroundTransparent</code></li>
+* <li><code> NumberFormat</code></li>
+* <li><code> ShadowFormat</code></li>
+* <li><code> HoriJustify</code></li>
+* <li><code> VertJustify</code></li>
+* <li><code> Orientation</code></li>
+* <li><code> CellProtection</code></li>
+* <li><code> TableBorder</code></li>
+* <li><code> IsTextWrapped</code></li>
+* <li><code> RotateAngle</code></li>
+* <li><code> RotateReference</code></li>
+* </ul> <p>
+* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+* @see com.sun.star.table.CellProperties
+*/
+public class _CellProperties extends MultiPropertyTest {
+
+
+ /**
+ * This property is tested with custom property tester which
+ * switches between 'Default' and 'Result' style names.
+ */
+ public void _CellStyle() {
+ testProperty("CellStyle", new PropertyTester() {
+ protected Object getNewValue(String name, Object old) {
+ return "Default".equals(old) ? "Result" : "Default" ;
+ }
+ }) ;
+ }
+
+ public void _UserDefinedAttributes() {
+ XNameContainer uda = null;
+ boolean res = false;
+ try {
+ uda = (XNameContainer) AnyConverter.toObject(
+ new Type(XNameContainer.class),
+ oObj.getPropertyValue("UserDefinedAttributes"));
+ AttributeData attr = new AttributeData();
+ attr.Namespace = "http://www.sun.com/staroffice/apitest/Cellprop";
+ attr.Type="CDATA";
+ attr.Value="true";
+ uda.insertByName("Cellprop:has-first-alien-attribute",attr);
+ String[] els = uda.getElementNames();
+ oObj.setPropertyValue("UserDefinedAttributes",uda);
+ uda = (XNameContainer) AnyConverter.toObject(
+ new Type(XNameContainer.class),
+ oObj.getPropertyValue("UserDefinedAttributes"));
+ els = uda.getElementNames();
+ Object obj = uda.getByName("Cellprop:has-first-alien-attribute");
+ res = true;
+ } catch (com.sun.star.beans.UnknownPropertyException upe) {
+ log.println("Don't know the Property 'UserDefinedAttributes'");
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ log.println("WrappedTargetException while getting Property 'UserDefinedAttributes'");
+ } catch (com.sun.star.container.NoSuchElementException nee) {
+ log.println("added Element isn't part of the NameContainer");
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ log.println("IllegalArgumentException while getting Property 'UserDefinedAttributes'");
+ } catch (com.sun.star.beans.PropertyVetoException pve) {
+ log.println("PropertyVetoException while getting Property 'UserDefinedAttributes'");
+ } catch (com.sun.star.container.ElementExistException eee) {
+ log.println("ElementExistException while getting Property 'UserDefinedAttributes'");
+ }
+ tRes.tested("UserDefinedAttributes",res);
+ }
+
+} // finish class _CellProperties
+
diff --git a/qadevOOo/tests/java/ifc/table/_TableColumn.java b/qadevOOo/tests/java/ifc/table/_TableColumn.java
new file mode 100644
index 000000000000..edb2606b87a4
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_TableColumn.java
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiPropertyTest;
+import util.ValueComparer;
+
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Testing <code>com.sun.star.table.TableColumn</code>
+* service properties :
+* <ul>
+* <li><code> Width</code></li>
+* <li><code> OptimalWidth</code></li>
+* <li><code> IsVisible</code></li>
+* <li><code> IsStartOfNewPage</code></li>
+* </ul> <p>
+* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+* @see com.sun.star.table.TableColumn
+*/
+public class _TableColumn extends MultiPropertyTest {
+
+ public void _OptimalWidth() {
+ boolean res = false;
+ try {
+ XInterface tObject = tEnv.getTestObject();
+ XCellRange aRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, tObject);
+ aRange.getCellByPosition(0,0).setFormula("Thats a pretty long text");
+ Object width_before = oObj.getPropertyValue("Width");
+ log.println("Before setting to optimal width: "+width_before);
+ oObj.setPropertyValue("OptimalWidth", new Boolean(true));
+ Object width_after = oObj.getPropertyValue("Width");
+ log.println("After setting to optimal width: "+width_after);
+ res = ! ValueComparer.equalValue(width_before,width_after);
+ } catch (Exception e) {
+ res = false;
+ e.printStackTrace(log);
+ }
+
+ tRes.tested("OptimalWidth",res );
+ }
+
+} //finish class _TableColumn
+
+
diff --git a/qadevOOo/tests/java/ifc/table/_TableRow.java b/qadevOOo/tests/java/ifc/table/_TableRow.java
new file mode 100644
index 000000000000..e5021f22dc55
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_TableRow.java
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiPropertyTest;
+
+/**
+* Testing <code>com.sun.star.table.TableRow</code>
+* service properties :
+* <ul>
+* <li><code> Height</code></li>
+* <li><code> OptimalHeight</code></li>
+* <li><code> IsVisible</code></li>
+* <li><code> IsStartOfNewPage</code></li>
+* </ul> <p>
+* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+* @see com.sun.star.table.TableRow
+*/
+public class _TableRow extends MultiPropertyTest {
+
+} // finish class _TableRow
+
diff --git a/qadevOOo/tests/java/ifc/table/_XAutoFormattable.java b/qadevOOo/tests/java/ifc/table/_XAutoFormattable.java
new file mode 100644
index 000000000000..4843d25f93fc
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XAutoFormattable.java
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import java.util.Random;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.table.XAutoFormattable;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+/**
+* Testing <code>com.sun.star.table.XAutoFormattable</code>
+* interface methods :
+* <ul>
+* <li><code> autoFormat()</code></li>
+* </ul> <p>
+* The component tested <b>must implement</b> interface
+* <code>com.sun.star.table.XCellRange</code>. <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.table.XAutoFormattable
+*/
+public class _XAutoFormattable extends MultiMethodTest {
+ public XAutoFormattable oObj = null;
+
+ /**
+ * First 'Default' autoformat is set and a background of a cell
+ * is obtained. Then any other autoformat is set and background
+ * of a cell is obtained again.<p>
+ * Has <b> OK </b> status if backgrounds with different autoformat
+ * settings are differ. <p>
+ */
+ public void _autoFormat() {
+ boolean bResult = true;
+ XMultiServiceFactory oMSF = (XMultiServiceFactory) tParam.getMSF();
+ String name = "Default";
+
+ try {
+ oObj.autoFormat(name); // applying default format
+
+ // getting current background of the cell
+ XCellRange cellRange = (XCellRange) UnoRuntime.queryInterface(
+ XCellRange.class, oObj);
+ XCell oCell = cellRange.getCellByPosition(0, 0);
+ XPropertySet PS = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oCell);
+
+ Integer bkgrnd1;
+ try {
+ bkgrnd1 = (Integer) PS.getPropertyValue("CellBackColor");
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ bkgrnd1 = (Integer) PS.getPropertyValue("BackColor");
+ }
+
+ // getting formats names.
+ XInterface iFormats = (XInterface) oMSF.createInstance(
+ "com.sun.star.sheet.TableAutoFormats");
+ XNameAccess formats = (XNameAccess) UnoRuntime.queryInterface(
+ XNameAccess.class, iFormats);
+ String[] names = formats.getElementNames();
+
+ // getting one random not default style name
+ Random rnd = new Random();
+
+ if (names.length > 1) {
+ while (name.equals("Default")) {
+ name = names[rnd.nextInt(names.length)];
+ }
+ } else {
+ name = names[0];
+ }
+
+ log.println("Applying style " + name);
+
+
+ // applying style
+ oObj.autoFormat(name);
+
+ // getting new cell's backround.
+ Integer bkgrnd2;
+ try {
+ bkgrnd2 = (Integer) PS.getPropertyValue("CellBackColor");
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ bkgrnd2 = (Integer) PS.getPropertyValue("BackColor");
+ }
+
+ bResult &= !bkgrnd1.equals(bkgrnd2);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Exception occured :");
+ e.printStackTrace(log);
+ bResult = false;
+ }
+
+ tRes.tested("autoFormat()", bResult);
+ }
+
+ /**
+ * Forces environment recreation.
+ */
+ protected void after() {
+ disposeEnvironment();
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/table/_XCell.java b/qadevOOo/tests/java/ifc/table/_XCell.java
new file mode 100644
index 000000000000..0e29e2cbc644
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XCell.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.table.CellContentType;
+import com.sun.star.table.XCell;
+
+
+/**
+* Testing <code>com.sun.star.table.XCell</code>
+* interface methods :
+* <ul>
+* <li><code> getFormula()</code></li>
+* <li><code> setFormula()</code></li>
+* <li><code> getValue()</code></li>
+* <li><code> setValue()</code></li>
+* <li><code> getType()</code></li>
+* <li><code> getError()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.table.XCell
+*/
+public class _XCell extends MultiMethodTest {
+ public XCell oObj = null;
+
+ /**
+ * First time errors checked when a proper formula is entered.
+ * Second time an incorrect formula entered and errors are checked.<p>
+ * Has <b> OK </b> status if in the first case error code 0 returned,
+ * and in the second case none-zerro code returned. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> setFormula() </code> : the method must set proper
+ * formula into cell, so there must be no errors </li>
+ * </ul>
+ */
+ public void _getError() {
+ requiredMethod("setFormula()") ;
+
+ boolean result = true;
+
+ if (oObj.getError() != 0) {
+ result = false ;
+ log.println("getError(): Expected error code is 0, but returned " +
+ oObj.getError()) ;
+ }
+ oObj.setFormula("=sqrt(-2)") ; // incorrect formula
+ if (oObj.getError() == 0) {
+ result = false ;
+ log.println("getError(): # Non zero error code expected,"+
+ " but 0 returned") ;
+ }
+
+ tRes.tested("getError()", result);
+ } // end getError()
+
+ /**
+ * Sets a formula and then gets it. <p>
+ * Has <b> OK </b> status if the formula set are the same as get. <p>
+ */
+ public void _getFormula() {
+ boolean result = true;
+
+ String formula = "";
+ log.println("getFormula()");
+ oObj.setFormula("=2+2");
+
+ formula = (String) oObj.getFormula();
+
+ result &= formula.endsWith("2+2");
+ tRes.tested("getFormula()", result);
+ } // end getFormula()
+
+ /**
+ * Gets the type and check it. <p>
+ * Has <b> OK </b> status if the type is one of valid values. <p>
+ */
+ public void _getType() {
+ boolean result = true;
+ result = true ;
+ log.println("getType() ...");
+
+ if(oObj.getType() == CellContentType.EMPTY) result &= true ;
+ else if (oObj.getType() == CellContentType.VALUE) result &= true ;
+ else if (oObj.getType() == CellContentType.TEXT) result &= true ;
+ else if (oObj.getType() == CellContentType.FORMULA) result &= true ;
+ else result = false;
+
+ tRes.tested ("getType()", result) ;
+ } // end getType()
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method successfully returns
+ * and no exceptions were thrown. <p>
+ */
+ public void _getValue() {
+ boolean result = true;
+ double value = 0;
+ log.println("getValue() ...");
+
+ value = (double) oObj.getValue();
+
+ tRes.tested("getValue()",result);
+ } // end getValue()
+
+ /**
+ * Sets a formula and then gets it. <p>
+ * Has <b> OK </b> status if the formula set are the same as get. <p>
+ */
+ public void _setFormula() {
+ boolean result = true;
+ String formula = "";
+ log.println("setFormula() ...");
+
+ oObj.setFormula("=2/6") ;
+
+ formula = (String) oObj.getFormula();
+
+ result &= formula.endsWith("2/6");
+ tRes.tested ("setFormula()", result) ;
+ } // end setFormula
+
+ /**
+ * Sets a value and then gets it. <p>
+ * Has <b> OK </b> status if the value set is equal to value get. <p>
+ */
+ public void _setValue() {
+ boolean result = true;
+ double cellValue = 0;
+ log.println("setValue() ...");
+
+ oObj.setValue(222.333) ;
+ cellValue = (double) oObj.getValue() ;
+
+ result &= (cellValue == 222.333);
+ tRes.tested("setValue()", result);
+ } // end setValue()
+}
+
diff --git a/qadevOOo/tests/java/ifc/table/_XCellCursor.java b/qadevOOo/tests/java/ifc/table/_XCellCursor.java
new file mode 100644
index 000000000000..9f3aea9b4354
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XCellCursor.java
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XSheetCellCursor;
+import com.sun.star.sheet.XSheetCellRange;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCellCursor;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Testing <code>com.sun.star.table.XCellCursor</code>
+* interface methods :
+* <ul>
+* <li><code> gotoStart()</code></li>
+* <li><code> gotoEnd()</code></li>
+* <li><code> gotoNext()</code></li>
+* <li><code> gotoPrevious()</code></li>
+* <li><code> gotoOffset()</code></li>
+* </ul> <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'SHEET'</code> (of type <code>XSpreadsheet</code>):
+* is used for creating a new cell range.</li>
+* <ul> <p>
+*
+* The component tested <b>must implement</b>
+* <code>XCellRangeAddressable</code> interface. <p>
+*
+* Test is <b> NOT </b> multithread compilant. <p>
+* After test completion object environment has to be recreated.
+* @see com.sun.star.table.XCellCursor
+*/
+public class _XCellCursor extends MultiMethodTest {
+
+ public static XCellCursor oObj = null;
+ public static XSpreadsheet oSheet = null;
+
+ /**
+ * <code>XCellRangeAddressable</code> interface is queried
+ * first for getting current position of cursor. The cursor
+ * is moved to next cell. Address of cursor obtained before
+ * and after moving. <p>
+ * Has <b> OK </b> status if cursor column is changed after
+ * movement. <p>
+ */
+ public void _gotoNext(){
+ boolean bResult = false;
+ int startCol, endCol, startRow, endRow = 0;
+ int startCol2, endCol2, startRow2, endRow2 = 0;
+
+ XCellRangeAddressable oRange = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
+ CellRangeAddress oAddr = oRange.getRangeAddress();
+ startRow = oAddr.StartRow;
+ startCol = oAddr.StartColumn;
+ endRow = oAddr.EndRow;
+ endCol = oAddr.EndColumn;
+
+ oObj.gotoNext();
+
+ oAddr = oRange.getRangeAddress();
+ startRow2 = oAddr.StartRow;
+ startCol2 = oAddr.StartColumn;
+ endRow2 = oAddr.EndRow;
+ endCol2 = oAddr.EndColumn;
+
+ if (!(startCol == startCol2)){
+ bResult = true;
+ }
+ tRes.tested( "gotoNext()", bResult );
+ }
+
+ /**
+ * <code>XCellRangeAddressable</code> interface is queried
+ * first for getting current position of cursor. The cursor
+ * is moved then. Address of cursor obtained before
+ * and after moving. <p>
+ * Has <b> OK </b> status if starting column and row of
+ * cursor is changed after movement. <p>
+ */
+ public void _gotoOffset(){
+ boolean bResult = false;
+ int startCol, endCol, startRow, endRow = 0;
+ int startCol2, endCol2, startRow2, endRow2 = 0;
+
+ XCellRangeAddressable oRange = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
+ CellRangeAddress oAddr = oRange.getRangeAddress();
+ startRow = oAddr.StartRow;
+ startCol = oAddr.StartColumn;
+ endRow = oAddr.EndRow;
+ endCol = oAddr.EndColumn;
+
+ oObj.gotoOffset(4,4);
+
+ oAddr = oRange.getRangeAddress();
+ startRow2 = oAddr.StartRow;
+ startCol2 = oAddr.StartColumn;
+ endRow2 = oAddr.EndRow;
+ endCol2 = oAddr.EndColumn;
+ if (!(startCol == startCol2) || (startRow == startRow2)){
+ bResult = true;
+ }
+ tRes.tested( "gotoOffset()", bResult );
+ }
+
+ /**
+ * <code>XCellRangeAddressable</code> interface is queried
+ * first for getting current position of cursor. The cursor
+ * is moved to previous cell. Address of cursor obtained before
+ * and after moving. <p>
+ * Has <b> OK </b> status if cursor column is changed after
+ * movement. <p>
+ */
+ public void _gotoPrevious(){
+ boolean bResult = false;
+ int startCol, endCol, startRow, endRow = 0;
+ int startCol2, endCol2, startRow2, endRow2 = 0;
+
+ XCellRangeAddressable oRange = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
+ CellRangeAddress oAddr = oRange.getRangeAddress();
+ startRow = oAddr.StartRow;
+ startCol = oAddr.StartColumn;
+ endRow = oAddr.EndRow;
+ endCol = oAddr.EndColumn;
+
+ oObj.gotoPrevious();
+
+ oAddr = oRange.getRangeAddress();
+ startRow2 = oAddr.StartRow;
+ startCol2 = oAddr.StartColumn;
+ endRow2 = oAddr.EndRow;
+ endCol2 = oAddr.EndColumn;
+
+ if (!(startCol == startCol2)){
+ bResult = true;
+ }
+ tRes.tested( "gotoPrevious()", bResult );
+ }
+
+ /**
+ * <code>XCellRangeAddressable</code> interface is queried
+ * first for getting current position of cursor. The cursor
+ * is moved to the start of its range .
+ * Address of cursor obtained before and after moving. <p>
+ * Has <b> OK </b> status if cursor was collapsed to a single
+ * cell (i.e. start column is the same as end column) after
+ * movement. <p>
+ */
+ public void _gotoStart(){
+ boolean bResult = false;
+ int startCol, endCol, startRow, endRow = 0;
+
+ XCellRangeAddressable oRange = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
+ oObj.gotoStart();
+ CellRangeAddress oAddr = oRange.getRangeAddress();
+ startRow = oAddr.StartRow;
+ startCol = oAddr.StartColumn;
+ endRow = oAddr.EndRow;
+ endCol = oAddr.EndColumn;
+ if ((startCol == endCol) && (endRow == startRow)){
+ bResult = true;
+ }
+
+ tRes.tested( "gotoStart()", bResult );
+ }
+
+ /**
+ * A new cell range is created using spreadsheet passed by relation.
+ * The method is tested on that range. <code>gotoEnd</code> is
+ * called and range address is checked.<p>
+ * Has <b> OK </b> status if cursor was collapsed to a single
+ * cell (i.e. start column is the same as end column) after
+ * movement. <p>
+ */
+ public void _gotoEnd(){
+ //gotoEnd gets it's own cursor to see a change
+ oSheet = (XSpreadsheet) tEnv.getObjRelation("SHEET");
+ XCellRange testRange = oSheet.getCellRangeByName("$A$1:$g$7") ;
+ XSheetCellRange testSheetRange = (XSheetCellRange)
+ UnoRuntime.queryInterface(XSheetCellRange.class,testRange);
+ XSheetCellCursor oCellCursor = oSheet.createCursorByRange
+ (testSheetRange);
+ XCellCursor oCursor = (XCellCursor)
+ UnoRuntime.queryInterface(XCellCursor.class,oCellCursor);
+
+ boolean bResult = false;
+ int startCol, endCol, startRow, endRow = 0;
+
+ XCellRangeAddressable oRange = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, oCursor);
+ oCursor.gotoEnd();
+ CellRangeAddress oAddr = oRange.getRangeAddress();
+ startRow = oAddr.StartRow;
+ startCol = oAddr.StartColumn;
+ endRow = oAddr.EndRow;
+ endCol = oAddr.EndColumn;
+ if ((startCol == endCol) && (endRow == startRow)){
+ bResult = true;
+ }
+
+ tRes.tested( "gotoEnd()", bResult );
+ }
+
+ /**
+ * Forces object environment recreation.
+ */
+ protected void after() {
+ disposeEnvironment();
+ }
+
+
+} //EOC _XCellCursor
+
diff --git a/qadevOOo/tests/java/ifc/table/_XCellRange.java b/qadevOOo/tests/java/ifc/table/_XCellRange.java
new file mode 100644
index 000000000000..cb35b2137e6d
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XCellRange.java
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+
+/**
+* Testing <code>com.sun.star.table.XCellRange</code>
+* interface methods :
+* <ul>
+* <li><code> getCellByPosition()</code></li>
+* <li><code> getCellRangeByPosition()</code></li>
+* <li><code> getCellRangeByName()</code></li>
+* </ul> <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'ValidRange'</code> (of type <code>String</code>):
+* cell range that can be defined by the object test instead of
+* definition at this test ("<code>A1:A1</code>")</li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.table.XCellRange
+*/
+public class _XCellRange extends MultiMethodTest {
+ public XCellRange oObj = null;
+
+ /**
+ * First a cell get from valid position, second - from invalid. <p>
+ * Has <b> OK </b> status if in the first case not null value is
+ * returned and no exceptions are thrown, and in the second
+ * case <code>IndexOutOfBoundsException</code> is thrown. <p>
+ */
+ public void _getCellByPosition() {
+
+ boolean result = false;
+
+ try {
+ XCell cell = oObj.getCellByPosition(0,0);
+ result = cell != null ;
+ log.println("Getting cell by position with a valid position ... OK");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occurred while getting cell by position with a valid position");
+ e.printStackTrace(log);
+ result = false;
+ }
+
+ try {
+ oObj.getCellByPosition(-1,1);
+ log.println("No Exception occurred while getting cell by position with invalid position");
+ result &= false;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Getting cell by position with a invalid position ... OK");
+ result &= true;
+ }
+
+ tRes.tested( "getCellByPosition()", result );
+
+ } // end getCellByPosition()
+
+ /**
+ * A range is tried to obtain with valid name. <p>
+ * Has <b> OK </b> status if not null range is
+ * returned. <p>
+ */
+ public void _getCellRangeByName() {
+
+ boolean result = false;
+
+ String valid = (String) tEnv.getObjRelation("ValidRange");
+ if (valid == null ) valid = "A1:A1";
+ XCellRange range = oObj.getCellRangeByName(valid);
+ result = range != null ;
+ log.println("Getting cellrange by name with a valid name ... OK");
+
+ tRes.tested( "getCellRangeByName()", result );
+
+
+ } // end getCellRangeByName()
+
+ /**
+ * First a range is tried to obtain with valid bounds,
+ * second - with invalid. <p>
+ * Has <b> OK </b> status if in the first case not null range is
+ * returned and no exceptions are thrown, and in the second
+ * case <code>IndexOutOfBoundsException</code> is thrown. <p>
+ */
+ public void _getCellRangeByPosition() {
+
+ boolean result = false;
+
+ try {
+ XCellRange range = oObj.getCellRangeByPosition(0,0,0,0);
+ result = range != null;
+ log.println("Getting cellrange by Position with a valid position ... OK");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occurred while getting cellrange by position with a valid position");
+ e.printStackTrace(log);
+ result = false;
+ }
+
+ try {
+ oObj.getCellRangeByPosition(-1,0,-1,1);
+ log.println("No Exception occurred while getting cellrange by position with invalid position");
+ result &= false;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Getting cellrange by position with a invalid position ... OK");
+ result &= true;
+ }
+
+ tRes.tested( "getCellRangeByPosition()", result );
+
+
+ } // end getCellRangeByPosition()
+
+ /**
+ * Forces environment recreation.
+ */
+ protected void after() {
+ disposeEnvironment();
+ }
+
+} // finish class _XCellRange
+
diff --git a/qadevOOo/tests/java/ifc/table/_XColumnRowRange.java b/qadevOOo/tests/java/ifc/table/_XColumnRowRange.java
new file mode 100644
index 000000000000..f56899891353
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XColumnRowRange.java
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.table.XColumnRowRange;
+
+/**
+* Testing <code>com.sun.star.table.XColumnRowRange</code>
+* interface methods :
+* <ul>
+* <li><code> getColumns()</code></li>
+* <li><code> getRows()</code></li>
+* </ul> <p>
+* @see com.sun.star.table.XColumnRowRange
+*/
+public class _XColumnRowRange extends MultiMethodTest {
+
+ public XColumnRowRange oObj = null;
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not null value
+ * and no exceptions were thrown. <p>
+ */
+ public void _getColumns() {
+ tRes.tested( "getColumns()", oObj.getColumns()!=null );
+ } // getColumns()
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not null value
+ * and no exceptions were thrown. <p>
+ */
+ public void _getRows() {
+ tRes.tested( "getRows()", oObj.getRows()!=null );
+ } // getRows()
+
+} // finish class _XColumnRowRange
+
diff --git a/qadevOOo/tests/java/ifc/table/_XTableChart.java b/qadevOOo/tests/java/ifc/table/_XTableChart.java
new file mode 100644
index 000000000000..230c0f5b0949
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XTableChart.java
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+import util.ValueComparer;
+
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XTableChart;
+
+/**
+* Testing <code>com.sun.star.table.XTableChart</code>
+* interface methods :
+* <ul>
+* <li><code> getHasColumnHeaders()</code></li>
+* <li><code> setHasColumnHeaders()</code></li>
+* <li><code> getHasRowHeaders()</code></li>
+* <li><code> setHasRowHeaders()</code></li>
+* <li><code> getRanges()</code></li>
+* <li><code> setRanges()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.table.XTableChart
+*/
+public class _XTableChart extends MultiMethodTest {
+
+ public XTableChart oObj = null;
+
+ /**
+ * Sets the property to <code>false</code> and then check it. <p>
+ * Has <b> OK </b> status if the method returns <code>false</code>. <p>
+ */
+ public void _getHasColumnHeaders() {
+ oObj.setHasColumnHeaders(false);
+ tRes.tested("getHasColumnHeaders()", !oObj.getHasColumnHeaders() );
+ } // getHasColumnHeaders()
+
+ /**
+ * Sets the property to <code>true</code> and then check it. <p>
+ * Has <b> OK </b> status if the method returns <code>true</code>. <p>
+ */
+ public void _setHasColumnHeaders() {
+ oObj.setHasColumnHeaders(true);
+ tRes.tested("setHasColumnHeaders()", oObj.getHasColumnHeaders() );
+ } // setHasColumnHeaders()
+
+ /**
+ * Sets the property to <code>false</code> and then check it. <p>
+ * Has <b> OK </b> status if the method returns <code>false</code>. <p>
+ */
+ public void _getHasRowHeaders() {
+ oObj.setHasRowHeaders(false);
+ tRes.tested("getHasRowHeaders()", !oObj.getHasRowHeaders() );
+ } // getHasRowHeaders()
+
+ /**
+ * Sets the property to <code>true</code> and then check it. <p>
+ * Has <b> OK </b> status if the method returns <code>true</code>. <p>
+ */
+ public void _setHasRowHeaders() {
+ oObj.setHasRowHeaders(true);
+ tRes.tested("setHasRowHeaders()", oObj.getHasRowHeaders() );
+ } // setHasRowHeaders()
+
+ CellRangeAddress[] the_Ranges = null;
+
+ /**
+ * Test calls the method and stores the range returned. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> valuie. <p>
+ */
+ public void _getRanges() {
+ the_Ranges = oObj.getRanges();
+ tRes.tested("getRanges()", the_Ranges != null );
+ } // getRanges()
+
+ /**
+ * Changes the first range in range array obtained by
+ * <code>getRanges</code> method, then set changed array. <p>
+ * Has <b> OK </b> status if range array get is the same as was
+ * set. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getRanges() </code> : to have initial ranges </li>
+ * </ul>
+ */
+ public void _setRanges() {
+ requiredMethod("getRanges()");
+ CellRangeAddress[] tmpRanges = oObj.getRanges();
+ tmpRanges[0].EndRow = 1;
+ oObj.setRanges(tmpRanges);
+ tRes.tested("setRanges()", ValueComparer.equalValue(
+ tmpRanges,oObj.getRanges()));
+ oObj.setRanges(the_Ranges);
+ } // getRanges()
+
+} // finish class _XTableChartsSupplier
+
+
+
diff --git a/qadevOOo/tests/java/ifc/table/_XTableCharts.java b/qadevOOo/tests/java/ifc/table/_XTableCharts.java
new file mode 100644
index 000000000000..737a120f91a8
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XTableCharts.java
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XTableCharts;
+
+/**
+* Testing <code>com.sun.star.table.XTableCharts</code>
+* interface methods :
+* <ul>
+* <li><code> addNewByName()</code></li>
+* <li><code> removeByName()</code></li>
+* </ul> <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'ADDR'</code>
+* (of type <code>com.sun.star.table.CellRangeAddress[]</code>):
+* data source ranges for chart creating. </li>
+* <li> <code>'RECT'</code>
+* (of type <code>com.sun.star.awt.Rectangle</code>):
+* the position of chart </li>
+* <ul> <p>
+* Test is <b> NOT </b> multithread compilant. <p>
+* @see com.sun.star.table.XTableCharts
+*/
+public class _XTableCharts extends MultiMethodTest {
+
+ public XTableCharts oObj = null;
+
+ /**
+ * Adds a new chart into table with specified name . <p>
+ * Has <b> OK </b> status if <code>hasByName()</code> returns
+ * <code>true</code>. <p>
+ */
+ public void _addNewByName() {
+
+ CellRangeAddress[] the_Range = (CellRangeAddress[])
+ tEnv.getObjRelation("ADDR");
+ Rectangle the_rect = (Rectangle) tEnv.getObjRelation("RECT");
+ oObj.addNewByName("XTableCharts",the_rect,the_Range,true,true);
+ tRes.tested("addNewByName()", oObj.hasByName("XTableCharts") );
+
+ } // addNewByName()
+
+ /**
+ * Removes the chart added before. <p>
+ * Has <b> OK </b> status if <code>hasByName()</code> returns
+ * <code>false</code>. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> addNewByName() </code> : chart mst be added first </li>
+ * </ul>
+ */
+ public void _removeByName() {
+ requiredMethod("addNewByName()") ;
+
+ oObj.removeByName("XTableCharts");
+ tRes.tested("removeByName()", !oObj.hasByName("XTableCharts") );
+
+ } // removeByName()
+
+} // finish class _XTableCharts
+
+
+
diff --git a/qadevOOo/tests/java/ifc/table/_XTableChartsSupplier.java b/qadevOOo/tests/java/ifc/table/_XTableChartsSupplier.java
new file mode 100644
index 000000000000..ba0308da29f2
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XTableChartsSupplier.java
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.table.XTableChartsSupplier;
+
+/**
+* Testing <code>com.sun.star.table.XTableChartsSupplier</code>
+* interface methods :
+* <ul>
+* <li><code> getCharts()</code></li>
+* </ul> <p>
+* @see com.sun.star.table.XTableChartsSupplier
+*/
+public class _XTableChartsSupplier extends MultiMethodTest {
+
+ public XTableChartsSupplier oObj = null;
+
+ /**
+ * Test calls the method. <p>
+ * Has <b> OK </b> status if the method returns not
+ * <code>null</code> value.
+ */
+ public void _getCharts() {
+
+ tRes.tested( "getCharts()", oObj.getCharts()!=null );
+
+ } // getCharts()
+
+} // finish class _XTableChartsSupplier
+
+
+
diff --git a/qadevOOo/tests/java/ifc/table/_XTableColumns.java b/qadevOOo/tests/java/ifc/table/_XTableColumns.java
new file mode 100644
index 000000000000..d46ae6dae70e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XTableColumns.java
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import lib.MultiMethodTest;
+import lib.Status;
+import lib.StatusException;
+
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Testing <code>com.sun.star.table.XTableColumns</code>
+* interface methods :
+* <ul>
+* <li><code> insertByIndex()</code></li>
+* <li><code> removeByIndex()</code></li>
+* </ul> <p>
+*
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'XTableColumns.XCellRange'</code> : <code>
+* com.sun.star.table.XCellRange</code> the cell range of
+* columns.</li>
+* <ul> <p>
+*
+* Test is multithread compilant. <p>
+* @see com.sun.star.table.XTableColumns
+*/
+public class _XTableColumns extends MultiMethodTest {
+
+ public XTableColumns oObj = null;
+ private XCellRange xCellRange = null;
+ private int lastColumn = 0;
+
+ public void before() {
+ xCellRange = (XCellRange)
+ tEnv.getObjRelation("XTableColumns.XCellRange") ;
+
+ if (xCellRange == null) throw new
+ StatusException(Status.failed("Relation missing"));
+
+ lastColumn = oObj.getCount() - 1 ;
+ }
+
+ /**
+ * First a number of cells in cell range are filled with data.
+ *
+ * Then columns inserted to valid positions : 1 column at 1,
+ * 1 column at 0, 2 columns at 0. <p>
+ *
+ * Then columns inserted to invalid positions : position -1,
+ * the column after last, and 0 columns inserted. <p>
+ *
+ * Has <b> OK </b> status if for valid cases :
+ * <ul>
+ * <li> content of other cells are properly shifted </li>
+ * <li> inserted columns are empty </li>
+ * <li> number of columns increases (in case if it is not the whole
+ * spreadsheet) by proper number. </li>
+ * </ul>
+ * and for invalid cases exception is thrown.
+ */
+ public void _insertByIndex() {
+
+ boolean result = true;
+ int origCnt = oObj.getCount();
+
+ try {
+ log.println("Filling range ... ");
+ fillRange(xCellRange);
+
+ log.println("Inserting 1 column at position 1 ...");
+ oObj.insertByIndex(1,1);
+
+ result &= checkColumn(0, 0);
+ result &= checkColumnEmpty(1);
+ result &= checkColumn(2, 1);
+ result &= checkColumn(3, 2);
+ result &= checkColumnEmpty(4);
+
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn + 1, lastColumn);
+ result &= oObj.getCount() == origCnt + 1;
+ } else {
+ result &= checkColumnEmpty(lastColumn);
+ }
+
+ log.println("Inserting 1 column at position 0 ...");
+ oObj.insertByIndex(0,1);
+
+ result &= checkColumnEmpty(0);
+ result &= checkColumn(1, 0);
+ result &= checkColumnEmpty(2);
+ result &= checkColumn(3, 1);
+ result &= checkColumn(4, 2);
+ result &= checkColumnEmpty(5);
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn + 2, lastColumn);
+ result &= oObj.getCount() == origCnt + 2;
+ }
+
+ log.println("Inserting 2 columns at position 0 ...");
+ oObj.insertByIndex(0,2);
+
+ result &= checkColumnEmpty(0);
+ result &= checkColumnEmpty(1);
+ result &= checkColumnEmpty(2);
+ result &= checkColumn(3, 0);
+ result &= checkColumnEmpty(4);
+ result &= checkColumn(5, 1);
+ result &= checkColumn(6, 2);
+ result &= checkColumnEmpty(7);
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn + 4, lastColumn);
+ }
+
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ result = false;
+ }
+
+
+ // spreadsheet supports 256 columns and after inserting
+ // or removing a column their number remains the same
+ if (origCnt < 200) {
+ log.println("Checking that number of column increased.");
+ result &= oObj.getCount() == origCnt + 4;
+ log.println("Before: " + origCnt + ", After: " + oObj.getCount());
+ } else {
+ log.println("Number of columns is " + origCnt + ",") ;
+ log.println("supposing that this is the whole spreadsheet and ");
+ log.println("number of columns should not change.");
+ }
+
+ try {
+ oObj.insertByIndex(-1,1);
+ log.println("No Exception occurred while inserting column at -1");
+ result &= false;
+ } catch (Exception e) {
+ log.println("Inserting column at Index -1 ... OK");
+ result &= true;
+ }
+
+ int cnt = oObj.getCount();
+ try {
+ oObj.insertByIndex(cnt, 1);
+ log.println("No Exception occurred while inserting column at "
+ + cnt);
+ result &= false;
+ } catch (Exception e) {
+ log.println("Inserting column at Index " + cnt + " ... OK");
+ result &= true;
+ }
+
+ if (tEnv.getTestCase().getObjectName().equals("ScTableColumnsObj")) {
+
+ try {
+ oObj.insertByIndex(0,0);
+ log.println("No Exception occurred while inserting 0 columns");
+ result &= false;
+ } catch (Exception e) {
+ log.println("Inserting 0 columns ... OK");
+ result &= true;
+ }
+
+ }
+
+ tRes.tested( "insertByIndex()", result );
+
+ } // end insertByIndex()
+
+ /**
+ * Columns removed from valid positions : 1 column at 1,
+ * 1 column at 0, 2 columns at 0. <p>
+ *
+ * Then columns removed from invalid positions : position -1,
+ * the column after last, and 0 columns removed. <p>
+ *
+ * Has <b> OK </b> status if for valid cases :
+ * <ul>
+ * <li> content of other cells are properly shifted </li>
+ * <li> columns which are shifted left are empty </li>
+ * <li> number of columns decreases (in case if it is not the whole
+ * spreadsheet) by proper number. </li>
+ * </ul>
+ * and for invalid cases exception is thrown.
+ */
+ public void _removeByIndex() {
+ executeMethod("insertByIndex()");
+
+ boolean result = true;
+ int origCnt = oObj.getCount();
+
+ try {
+ log.println("Filling range ... ");
+
+ log.println("Removing 2 columns at position 0 ...");
+ oObj.removeByIndex(0,2);
+
+ result &= checkColumnEmpty(0);
+ result &= checkColumn(1, 0);
+ result &= checkColumnEmpty(2);
+ result &= checkColumn(3, 1);
+ result &= checkColumn(4, 2);
+ result &= checkColumnEmpty(5);
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn + 2, lastColumn);
+ result &= oObj.getCount() == origCnt - 2;
+ }
+
+ log.println("Removing 1 column at position 0 ...");
+ oObj.removeByIndex(0,1);
+
+ result &= checkColumn(0, 0);
+ result &= checkColumnEmpty(1);
+ result &= checkColumn(2, 1);
+ result &= checkColumn(3, 2);
+ result &= checkColumnEmpty(4);
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn + 1, lastColumn);
+ result &= oObj.getCount() == origCnt - 3;
+ }
+
+ log.println("Removing 1 column at position 1 ...");
+ oObj.removeByIndex(1,1);
+
+ result &= checkColumn(0, 0);
+ result &= checkColumn(1, 1);
+ result &= checkColumn(2, 2);
+ result &= checkColumnEmpty(3);
+ if (lastColumn < 200) {
+ result &= checkColumn(lastColumn, lastColumn);
+ }
+
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ result = false;
+ }
+
+
+ // spreadsheet supports 256 columns and after inserting
+ // or removing a column their number remains the same
+ if (origCnt < 200) {
+ log.println("Checking that number of column increased.");
+ result &= oObj.getCount() == origCnt - 4;
+ log.println("Before: " + origCnt + ", After: " + oObj.getCount());
+ } else {
+ log.println("Number of columns is " + origCnt + ",") ;
+ log.println("supposing that this is the whole spreadsheet and ");
+ log.println("number of columns should not change.");
+ }
+
+ try {
+ oObj.removeByIndex(-1,1);
+ log.println("No Exception occurred while removing column at -1");
+ result &= false;
+ } catch (Exception e) {
+ log.println("removing column at Index -1 ... OK");
+ result &= true;
+ }
+
+ int cnt = oObj.getCount();
+ try {
+ oObj.removeByIndex(cnt, 1);
+ log.println("No Exception occurred while removing column at "
+ + cnt);
+ result &= false;
+ } catch (Exception e) {
+ log.println("Removing column at Index " + cnt + " ... OK");
+ result &= true;
+ }
+
+ if (tEnv.getTestCase().getObjectName().equals("ScTableColumnsObj")) {
+ try {
+ oObj.removeByIndex(0,0);
+ log.println("No Exception occurred while removing 0 columns");
+ result &= false;
+ } catch (Exception e) {
+ log.println("removing 0 columns ... OK");
+ result &= true;
+ }
+ }
+
+ tRes.tested( "removeByIndex()", result );
+ } // end removeByIndex()
+
+ private void setCellText(XCell cell, String text) {
+ XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface
+ (XSimpleText.class, cell) ;
+ xText.setString(text);
+ }
+ private String getCellText(XCell cell) {
+ XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface
+ (XSimpleText.class, cell) ;
+ return xText.getString();
+ }
+
+ /**
+ * Fills the range with some data : two rows and 3 columns, and
+ * some columns are cleared.
+ *
+ * @param xRange Range to fill
+ * @throws IndexOutOfBoundsException if any errors occur during filling.
+ */
+ private void fillRange(XCellRange xRange)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+
+ for (int i = 0; i <= lastColumn && i < 3; i++) {
+ setCellText(xRange.getCellByPosition(i, 0), "" + i + "a");
+ setCellText(xRange.getCellByPosition(i, 1), "" + i + "b");
+ }
+
+ for (int i = 3; i <= lastColumn && i < 10; i++) {
+ setCellText(xRange.getCellByPosition(i, 0), "");
+ setCellText(xRange.getCellByPosition(i, 1), "");
+ }
+ }
+
+ /**
+ * Check the column (first two rows) if it has values with
+ * index specified.
+ *
+ * @param col Column to check
+ * @param idx What indexes must be in cells
+ * @return <code>true</code> if expected indexes are found,
+ * <code>false</code> otherwise.
+ * @throws IndexOutOfBoundsException
+ */
+ private boolean checkColumn(int col, int idx)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+
+ if (col >= oObj.getCount()) return true;
+
+ String c1 = getCellText(xCellRange.getCellByPosition(col, 0));
+ String c2 = getCellText(xCellRange.getCellByPosition(col, 1));
+
+ if (!((""+ idx + "a").equals(c1) && (""+ idx + "b").equals(c2))) {
+
+ log.println("FAILED for column " + col + " and index " + idx + "("
+ + c1 + "," + c2 + ")");
+ return false ;
+ }
+ return true;
+ }
+
+ /**
+ * Checks if the column (first two rows) has no data in its cells.
+ *
+ * @param col Column to check
+ * @return <code>true</code> if the column is empty, <code>false</code>
+ * if first two cells contains some strings.
+ * @throws IndexOutOfBoundsException
+ */
+ private boolean checkColumnEmpty(int col)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+
+ if (col >= oObj.getCount()) return true;
+
+ String c1 = getCellText(xCellRange.getCellByPosition(col, 0));
+ String c2 = getCellText(xCellRange.getCellByPosition(col, 1));
+ if (!("".equals(c1) && "".equals(c2))) {
+ log.println("FAILED for column " + col + " is not empty ("
+ + c1 + "," + c2 + ")");
+ return false ;
+ }
+ return true;
+ }
+
+ } //finish class _XTableColumns
+
diff --git a/qadevOOo/tests/java/ifc/table/_XTableRows.java b/qadevOOo/tests/java/ifc/table/_XTableRows.java
new file mode 100644
index 000000000000..71cd35ab5de9
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/table/_XTableRows.java
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * 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 ifc.table;
+
+import com.sun.star.table.XCellRange;
+import lib.MultiMethodTest;
+
+import com.sun.star.table.XTableRows;
+import lib.Status;
+import lib.StatusException;
+
+/**
+* Testing <code>com.sun.star.table.XTableRows</code>
+* interface methods :
+* <ul>
+* <li><code> insertByIndex()</code></li>
+* <li><code> removeByIndex()</code></li>
+* </ul>
+*/
+public class _XTableRows extends MultiMethodTest {
+
+ public XTableRows oObj = null;
+ public XCellRange range = null;
+
+ public void before() {
+ range = (XCellRange) tEnv.getObjRelation("XTableRows.XCellRange");
+ if (range==null) {
+ throw new StatusException(Status.failed("ObjectRelation missing"));
+ }
+ try {
+ range.getCellByPosition(0,0).setValue(17);
+ range.getCellByPosition(0,1).setValue(15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't set value for Cell A1");
+ }
+ }
+
+ /**
+ * First a row inserted to valid position, then to invalid. <p>
+ * Has <b> OK </b> status if in the first case number of rows increases
+ * by 1, and in the second an exception is thrown. <p>
+ */
+ public void _insertByIndex() {
+
+ boolean result = true;
+
+ requiredMethod("removeByIndex()");
+
+ int origCnt = oObj.getCount();
+ log.println("Inserting row before first row");
+ oObj.insertByIndex(0,1);
+ result &= checkCell(1,15);
+ if (checkCell(1,15)) log.println("... successful");
+
+ try {
+ oObj.insertByIndex(-1,1);
+ log.println("No Exception occurred while inserting row at -1");
+ result &= false;
+ } catch (Exception e) {
+ log.println("Inserting row at Index -1 ... OK");
+ result &= true;
+ }
+
+ tRes.tested( "insertByIndex()", result );
+
+ } // end insertByIndex()
+
+ /**
+ * First a row removed from valid position, then from invalid. <p>
+ *
+ * Has <b> OK </b> status if in the first case number of columns decreases
+ * by 1, and in the second an exception is thrown. <p>
+ */
+ public void _removeByIndex() {
+
+ boolean result = true;
+
+ oObj.removeByIndex(0,1);
+ log.println("Removing first row");
+ result &= checkCell(0,15);
+ if (checkCell(0,15)) log.println("... successful");
+
+ try {
+ oObj.removeByIndex(-1,1);
+ log.println("No Exception occurred while Removing row at -1");
+ result &= false;
+ } catch (Exception e) {
+ log.println("Removing row at Index -1 ... OK");
+ result &= true;
+ }
+
+ tRes.tested( "removeByIndex()", result );
+ } // end removeByIndex()
+
+ public boolean checkCell(int row,double expected) {
+ double getting=0;
+ try {
+ getting = range.getCellByPosition(0,row).getValue();
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't set value for Cell A1");
+ }
+
+ boolean res = (getting==expected);
+ if (!res) {
+ log.println("Expected for row "+row+" was "+expected);
+ log.println("Getting for row "+row+" - "+getting);
+ log.println("=> FAILED");
+ }
+ return res;
+ }
+
+} //finish class _XTableRows
+