CWS-TOOLING: integrate CWS sb123

This commit is contained in:
Vladimir Glazunov 2010-10-14 14:25:42 +02:00
commit a914be7eb2
18 changed files with 1059 additions and 776 deletions

View file

@ -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

7
sc/prj/build.lst Executable file → Normal file
View file

@ -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

View file

@ -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() {}
}

File diff suppressed because it is too large Load diff

View file

@ -25,69 +25,99 @@
#
#*************************************************************************
PRJ = ..$/..$/..
TARGET = ViewForward
PRJNAME = $(TARGET)
PACKAGE = complex$/calcPreview
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
.ELSE
PRJ = ../../..
PRJNAME = sc
TARGET = qa_complex_calcpreview
.IF "$(OOO_JUNIT_JAR)" != ""
PACKAGE = complex/calcPreview
JAVATESTFILES = \
TestDocument.java \
ViewForwarder.java
JAVAFILES = $(JAVATESTFILES)
JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar
EXTRAJARFILES = $(OOO_JUNIT_JAR)
.END
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
ALLTAR : javatest
.END
#----- 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)
# 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)
#

View file

@ -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();
}

View file

@ -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
PRJ = ../../..
PRJNAME = sc
TARGET = qa_complex_cellRanges
# test looks something like the.full.package.TestName
CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
.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
# start the runner application
CT_APP = org.openoffice.Runner
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
RUN: run
run:
+java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST)
ALLTAR : javatest
.END

View file

@ -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() );
// SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)param.getMSF() );
final XMultiServiceFactory xMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
SOfficeFactory SOF = SOfficeFactory.getFactory(xMsf);
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();
}

View file

@ -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 ;
}

View file

@ -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;
}

View file

@ -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 + "\"");
System.out.println("getting the name \"" + name + "\"");
if (loc_result) log.println("... getName() - OK");
else log.println("... getName() - FAILED");
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;

View file

@ -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;

View file

@ -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 ------------------------------------------------------

View file

@ -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 ------------------------------------------------------

View file

@ -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 ------------------------------------------------------

View file

@ -25,34 +25,35 @@
#
#*************************************************************************
PRJ = ..$/..$/..
TARGET = DataPilot
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
.ELSE
PRJ = ../../..
PRJNAME = sc
PACKAGE = complex$/dataPilot
TARGET = qa_complex_datapilot
.IF "$(OOO_JUNIT_JAR)" != ""
PACKAGE = complex/dataPilot
JAVATESTFILES = \
CheckDataPilot.java
JAVAFILES = $(JAVATESTFILES) \
_XDataPilotDescriptor.java \
_XDataPilotTable.java \
_XNamed.java \
_XPropertySet.java
JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
EXTRAJARFILES = $(OOO_JUNIT_JAR)
.END
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
ALLTAR : javatest
#----- compile .java files -----------------------------------------
.END
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)
SUBDIRS = interfaceTests$/beans interfaceTests$/container interfaceTests$/sheet
#----- make a jar from compiled files ------------------------------
MAXLINELENGTH = 100000
JARCLASSDIRS = $(PACKAGE)
JARTARGET = $(TARGET).jar
JARCOMPRESS = TRUE
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
run:
+java -cp $(CLASSPATH) org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b)

View file

@ -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;
}
}
@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();
}

View file

@ -25,33 +25,27 @@
#
#*************************************************************************
PRJ = ..$/..$/..
TARGET = CalcRTL
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
.ELSE
PRJ = ../../..
PRJNAME = sc
PACKAGE = complex$/sc
TARGET = qa_complex_sc
.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
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
ALLTAR : javatest
#----- compile .java files -----------------------------------------
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
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
run:
+java -cp "$(CLASSPATH)" org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b)
.END