diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-05-20 12:22:00 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-05-20 12:22:00 +0000 |
commit | c20313e0001b3061bf2b5711aea2300ffffde7c4 (patch) | |
tree | 280229e64414f1dcd4d1b2055016d3c745663e35 /qadevOOo | |
parent | 297a65ef6f42c245cb8a93514fce6ab508c86131 (diff) |
INTEGRATION: CWS koheidatapilot01 (1.9.52); FILE MERGED
2008/04/25 21:12:08 kohei 1.9.52.4: RESYNC: (1.9-1.10); FILE MERGED
2008/04/19 19:37:55 kohei 1.9.52.3: pass the XSpreadsheetDocument instance because the XDataPilotTable2 test code needs it.
2008/04/18 15:01:27 kohei 1.9.52.2: fixed redundant casting (it's what the java compiler says).
2008/04/18 02:59:48 kohei 1.9.52.1: create another DP table for testing XDataPilotTable2.
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java index 27901e71458f..243d5620b244 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ScDataPilotTableObj.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.11 $ * * This file is part of OpenOffice.org. * @@ -148,7 +148,7 @@ public class ScDataPilotTableObj extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); log.println("getting sheets"); - XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets(); + XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); XSpreadsheet oSheet = null; @@ -278,10 +278,81 @@ public class ScDataPilotTableObj extends TestCase { tEnv.addObjRelation("CELLFORCHANGE", oChangeCell); tEnv.addObjRelation("CELLFORCHECK", oCheckCell); tEnv.addObjRelation("FIELDSAMOUNT", new Integer(5)); + tEnv.addObjRelation("SHEETDOCUMENT", xSheetDoc); + + createTable2(oSheet, sCellRangeAddress, tEnv); return tEnv; } + /** + * Create a new DataPilot table output for use with testing XDataPilotTable2 + * interface. + * + * @param oSheet current sheet instance + * @param srcRange source range + * @param tEnv test environment instance + */ + private void createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv) + { + XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) + UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); + log.println("Creating test table object"); + XDataPilotTables DPT = DPTS.getDataPilotTables(); + XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor(); + DPDsc.setSourceRange(srcRange); + + XIndexAccess xIA = DPDsc.getDataPilotFields(); + int fieldCount = xIA.getCount() - 1; // skip the last field because it's always hidden. + try + { + for (int i = 0; i < fieldCount; ++i) + { + Object o = xIA.getByIndex(i); + XPropertySet fieldPropSet = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet.class, o); + + if (i == fieldCount - 1) + { + // last field + fieldPropSet.setPropertyValue( + "Function", com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.DATA); + } + else if (i%2 == 0) + { + // even number fields + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); + } + else if (i%2 == 1) + { + // odd number fields + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.ROW); + } + } + + if (DPT.hasByName("DataPilotTable2")) + DPT.removeByName("DataPilotTable2"); + + CellAddress destAddr = new CellAddress(); + destAddr.Sheet = 0; + destAddr.Column = 0; + destAddr.Row = 14; + DPT.insertNewByName("DataPilotTable2", destAddr, DPDsc); + + Object o = DPT.getByName("DataPilotTable2"); + tEnv.addObjRelation("DATAPILOTTABLE2", o); + } + catch (com.sun.star.uno.Exception e) + { + e.printStackTrace(log); + throw new StatusException("Couldn't create a test environment", e); + } + } + } |