qadevOOo/Jar_OOoRunner.mk | 3 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv | 16 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangeObj.csv | 7 qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java | 418 ------- qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2.java | 571 ---------- qadevOOo/tests/java/ifc/sheet/_XDatabaseRange.java | 237 ---- 6 files changed, 1252 deletions(-)
New commits: commit c22883f6018858bd3198059f696fa3dff264c24d Author: Jens Carl <[email protected]> Date: Fri Aug 11 07:24:52 2017 +0000 tdf#45904 Remove/disable obsolete _XDatabaseRange Java tests The _XDatabaseRange tests are already written in C++ since commit 95780ec73990f96dc16fc677c895d00fa1360008. Change-Id: Ib57cb1f69c0ebc17443c16e7d466ad3ccb535f19 Reviewed-on: https://gerrit.libreoffice.org/41007 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 08b62f442800..67511ce41228 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -600,7 +600,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery \ qadevOOo/tests/java/ifc/sheet/_XConsolidatable \ qadevOOo/tests/java/ifc/sheet/_XConsolidationDescriptor \ - qadevOOo/tests/java/ifc/sheet/_XDatabaseRange \ qadevOOo/tests/java/ifc/sheet/_XDatabaseRanges \ qadevOOo/tests/java/ifc/sheet/_XDataPilotField \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTable \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangeObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangeObj.csv index 13916ae2eb56..bf4b1387cc73 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangeObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDatabaseRangeObj.csv @@ -2,13 +2,6 @@ "ScDatabaseRangeObj";"com::sun::star::util::XRefreshable#optional";"addRefreshListener()" "ScDatabaseRangeObj";"com::sun::star::util::XRefreshable#optional";"removeRefreshListener()" "ScDatabaseRangeObj";"com::sun::star::sheet::XCellRangeReferrer";"getReferredCells()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"getDataArea()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"setDataArea()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"getSortDescriptor()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"getFilterDescriptor()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"getSubTotalDescriptor()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"getImportDescriptor()" -"ScDatabaseRangeObj";"com::sun::star::sheet::XDatabaseRange";"refresh()" "ScDatabaseRangeObj";"com::sun::star::container::XNamed";"getName()" "ScDatabaseRangeObj";"com::sun::star::container::XNamed";"setName()" "ScDatabaseRangeObj";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()" diff --git a/qadevOOo/tests/java/ifc/sheet/_XDatabaseRange.java b/qadevOOo/tests/java/ifc/sheet/_XDatabaseRange.java deleted file mode 100644 index d8b0bf69e234..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XDatabaseRange.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.sheet; - -import lib.MultiMethodTest; -import lib.Status; -import lib.StatusException; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.sheet.SubTotalColumn; -import com.sun.star.sheet.XDatabaseRange; -import com.sun.star.sheet.XSheetFilterDescriptor; -import com.sun.star.sheet.XSubTotalDescriptor; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.table.XCell; -import com.sun.star.table.XCellRange; - -/** -* Testing <code>com.sun.star.sheet.XDatabaseRange</code> -* interface methods : -* <ul> -* <li><code> getDataArea()</code></li> -* <li><code> setDataArea()</code></li> -* <li><code> getSortDescriptor()</code></li> -* <li><code> getFilterDescriptor()</code></li> -* <li><code> getSubTotalDescriptor()</code></li> -* <li><code> getImportDescriptor()</code></li> -* <li><code> refresh()</code></li> -* </ul> <p> -* This test needs the following object relations : -* <ul> -* <li> <code>'DATAAREA'</code> (of type <code>CellRangeAddress</code>): -* to have cell range address for test of method <code>getDataArea()</code></li> -* <li> <code>'XCELLRANGE'</code> (of type <code>XCellRange</code>): -* cell range of the spreadsheet with database range, -* to get values of cell</li> -* <ul> <p> -* @see com.sun.star.sheet.XDatabaseRange -* @see com.sun.star.table.CellRangeAddress -*/ -public class _XDatabaseRange extends MultiMethodTest { - - public XDatabaseRange oObj = null; - CellRangeAddress oldCRA = null; - XCellRange xCellRange = null; - - /** - * Retrieves object relations. - * @throws StatusException If one of relations not found. - */ - @Override - protected void before() { - oldCRA = (CellRangeAddress)tEnv.getObjRelation("DATAAREA"); - if (oldCRA == null) { - throw new StatusException(Status.failed - ("Relation 'DATAAREA' not found")); - } - xCellRange = (XCellRange)tEnv.getObjRelation("XCELLRANGE"); - if (xCellRange == null) { - throw new StatusException(Status.failed - ("Relation 'XCELLRANGE' not found")); - } - } - - /** - * Test calls the method and compares returned cell range address with - * cell range address obtained by object relation <code>'DATAAREA'</code>.<p> - * Has <b> OK </b> status if all fields of cell range addresses are equal. <p> - */ - public void _getDataArea() { - boolean bResult = true; - CellRangeAddress objCRA = oObj.getDataArea(); - bResult &= objCRA.EndColumn == oldCRA.EndColumn; - bResult &= objCRA.EndRow == oldCRA.EndRow; - bResult &= objCRA.Sheet == oldCRA.Sheet; - bResult &= objCRA.StartColumn == oldCRA.StartColumn; - bResult &= objCRA.StartRow == oldCRA.StartRow; - tRes.tested("getDataArea()", bResult); - } - - /** - * Test calls the method and checks returned value. <p> - * Has <b> OK </b> status if returned value isn't null. <p> - */ - public void _getFilterDescriptor() { - XSheetFilterDescriptor FD = oObj.getFilterDescriptor(); - tRes.tested("getFilterDescriptor()", FD != null); - } - - /** - * Test calls the method and checks returned value. <p> - * Has <b> OK </b> status if returned value isn't null. <p> - */ - public void _getImportDescriptor() { - PropertyValue[] pva = oObj.getImportDescriptor(); - tRes.tested("getImportDescriptor()", pva != null); - } - - /** - * Test calls the method and checks returned value. <p> - * Has <b> OK </b> status if returned value isn't null. <p> - */ - public void _getSortDescriptor() { - PropertyValue[] pva = oObj.getSortDescriptor(); - tRes.tested("getSortDescriptor()", pva != null); - } - - /** - * Test calls the method and checks returned value. <p> - * Has <b> OK </b> status if returned value isn't null. <p> - */ - public void _getSubTotalDescriptor() { - STD = oObj.getSubTotalDescriptor(); - tRes.tested("getSubTotalDescriptor()", STD != null); - } - - XSubTotalDescriptor STD = null; - - /** - * Test adds new SubTotalDescriptor and checks value of cell with - * subtotal sum after refresh() call. <p> - * Has <b> OK </b> if value of cell with subtotal sum was changed - * after refresh() call.<p> - */ - public void _refresh() { - requiredMethod("getSubTotalDescriptor()"); - requiredMethod("setDataArea()"); - - for(int i = STARTROW; i < ENDROW+1; i++) { - try { - XCell cell = xCellRange.getCellByPosition(COL, i); - cell.setValue(i); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); - e.printStackTrace(log); - tRes.tested("refresh()", false); - } - } - - SubTotalColumn[] STC = new SubTotalColumn[1]; - STC[0] = new SubTotalColumn(); - STC[0].Column = COL; - STC[0].Function = com.sun.star.sheet.GeneralFunction.SUM; - - double oldVal = 0; - try { - XCell checkCell = xCellRange.getCellByPosition(COL, ENDROW); - oldVal = checkCell.getValue(); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); - e.printStackTrace(log); - tRes.tested("refresh()", false); - } - log.println("Value of the cell (" + COL + ", " + ENDROW + - ") : " + oldVal ); - - log.println("Set new SubTotal descriptor..."); - - STD.clear(); - STD.addNew(STC, 1); - - double valBeforeRefresh = 0; - try { - XCell checkCell = xCellRange.getCellByPosition(COL, ENDROW); - valBeforeRefresh = checkCell.getValue(); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); - e.printStackTrace(log); - tRes.tested("refresh()", false); - } - log.println("Value of the cell (" + COL + ", " + ENDROW + - ") : " + valBeforeRefresh ); - - log.println("Now call refresh()..."); - oObj.refresh(); - - double valAfterRefresh = 0; - try { - XCell checkCell = xCellRange.getCellByPosition(COL, ENDROW); - valAfterRefresh = checkCell.getValue(); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); - e.printStackTrace(log); - tRes.tested("refresh()", false); - } - log.println("Value of the cell (" + COL + ", " + ENDROW + - ") : " + valAfterRefresh ); - - tRes.tested("refresh()", oldVal != valAfterRefresh && - oldVal == valBeforeRefresh); - } - - static final short COL = 0; - static final short STARTROW = 0; - static final short ENDROW = 5; - - /** - * Test creates new cell range address and calls the method. <p> - * Has <b> OK </b> status if the method successfully returns. <p> - */ - public void _setDataArea() { - executeMethod("getDataArea()"); - CellRangeAddress newCRA = new CellRangeAddress(); - newCRA.Sheet = oldCRA.Sheet; - newCRA.StartColumn = COL; - newCRA.EndColumn = COL; - newCRA.StartRow = STARTROW; - newCRA.EndRow = ENDROW; - - oObj.setDataArea(newCRA); - - tRes.tested("setDataArea()", true); - } - - @Override - protected void after() { - disposeEnvironment(); - } -} - - commit 8ab13df17936537a801d0d94c1479c5a8e38cce3 Author: Jens Carl <[email protected]> Date: Fri Aug 11 08:39:54 2017 +0000 tdf#45904 Remove/disable obsolete _XDataPilotTable2 Java tests The _XDataPilotTable2 tests are already written in C++ since commit c1589dbd450426928077694346b773b718e6ff78. Change-Id: Ic176f746eb94bff6c1cc7daeffedd8f22061dd96 Reviewed-on: https://gerrit.libreoffice.org/41013 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 10b605ad5c23..08b62f442800 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -604,7 +604,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XDatabaseRanges \ qadevOOo/tests/java/ifc/sheet/_XDataPilotField \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTable \ - qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2 \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTables \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTablesSupplier \ qadevOOo/tests/java/ifc/sheet/_XDDELink \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv index aa831b4632e7..25b3743c0e05 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv @@ -2,8 +2,3 @@ "ScDataPilotTableObj";"com::sun::star::container::XNamed";"setName()" "ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable";"getOutputRange()" "ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable";"refresh()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable2";"getDrillDownData()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable2";"getPositionData()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable2";"insertDrillDownSheet()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable2";"getOutputRangeByType()" - diff --git a/qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2.java b/qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2.java deleted file mode 100644 index 92f9d2c1fc6f..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2.java +++ /dev/null @@ -1,571 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -package ifc.sheet; - -import java.util.ArrayList; - -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XNamed; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.sheet.*; -import com.sun.star.table.CellAddress; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.table.XCell; -import com.sun.star.table.XCellCursor; -import com.sun.star.table.XCellRange; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; - -import lib.MultiMethodTest; -import lib.Status; -import lib.StatusException; -import util.utils; - -/** - * Testing <code>com.sun.star.sheet.XDataPilotTable2</code> - * interface methods : - * <ul> - * <li><code> getDrillDownData()</code><li> - * <li><code> getPositionData()</code></li> - * <li><code> insertDrillDownSheet()</code></li> - * <li><code> getOutputRangeByType</code></li> - * </ul> - * - * @see com.sun.star.sheet.XDataPilotTable2 - * @see com.sun.star.table.CellAddress - * - */ -public class _XDataPilotTable2 extends MultiMethodTest -{ - private XSpreadsheetDocument xSheetDoc = null; - private XDataPilotTable2 xDPTab2 = null; - private CellRangeAddress mRangeWhole = null; - private CellRangeAddress mRangeTable = null; - private CellRangeAddress mRangeResult = null; - private ArrayList<Integer> mDataFieldDims = null; - private ArrayList<CellAddress> mResultCells = null; - - public XDataPilotTable2 oObj; - - /** - * exception to be thrown when obtaining a result data for a cell fails - * (probably because the cell is not a result cell). - */ - private static class ResultCellFailure extends com.sun.star.uno.Exception {} - - @Override - protected void before() - { - Object o = tEnv.getObjRelation("DATAPILOTTABLE2"); - xDPTab2 = UnoRuntime.queryInterface( - XDataPilotTable2.class, o); - - if (xDPTab2 == null) - throw new StatusException(Status.failed("Relation not found")); - - xSheetDoc = (XSpreadsheetDocument)tEnv.getObjRelation("SHEETDOCUMENT"); - - getOutputRanges(); - buildDataFields(); - try - { - buildResultCells(); - } - catch (ResultCellFailure e) - { - e.printStackTrace(log); - throw new StatusException( "Failed to build result cells.", e); - } - } - - public void _getDrillDownData() - { - boolean testResult = true; - int cellCount = mResultCells.size(); - for (int i = 0; i < cellCount; ++i) - { - CellAddress addr = mResultCells.get(i); - DataPilotTablePositionData posData = xDPTab2.getPositionData(addr); - DataPilotTableResultData resData = (DataPilotTableResultData)posData.PositionData; - int dim = mDataFieldDims.get(resData.DataFieldIndex).intValue(); - DataResult res = resData.Result; - double val = res.Value; - - Object[][] data = xDPTab2.getDrillDownData(addr); - double sum = 0.0; - if (data.length > 1) - { - for (int row = 1; row < data.length; ++row) - { - Object o = data[row][dim]; - if (AnyConverter.isDouble(o)) - sum += ((Double)o).doubleValue(); - } - } - log.println(formatCell(addr) + ": " + data.length + " rows (" + (data.length-1) + " records)"); - - if (!utils.approxEqual(val, sum)) - testResult = false; - } - tRes.tested("getDrillDownData()", testResult); - } - - public void _getPositionData() - { - boolean testResult = false; - - do - { - CellAddress addr = new CellAddress(); - addr.Sheet = mRangeTable.Sheet; - - boolean rangeGood = true; - for (int x = mRangeTable.StartColumn; x <= mRangeTable.EndColumn && rangeGood; ++x) - { - for (int y = mRangeTable.StartRow; y <= mRangeTable.EndRow && rangeGood; ++y) - { - addr.Column = x; - addr.Row = y; - log.println("checking " + formatCell(addr)); - DataPilotTablePositionData posData = xDPTab2.getPositionData(addr); - if (posData.PositionType == DataPilotTablePositionType.NOT_IN_TABLE) - { - log.println("specified cell address not in table: " + formatCell(addr)); - rangeGood = false; - continue; - } - - switch (posData.PositionType) - { - case DataPilotTablePositionType.NOT_IN_TABLE: - break; - case DataPilotTablePositionType.COLUMN_HEADER: - printHeaderData(posData); - break; - case DataPilotTablePositionType.ROW_HEADER: - printHeaderData(posData); - break; - case DataPilotTablePositionType.RESULT: - printResultData(posData); - break; - case DataPilotTablePositionType.OTHER: - break; - default: - log.println("unknown position"); - } - } - } - - if (!rangeGood) - { - log.println("table range check failed"); - break; - } - - testResult = true; - } - while (false); - - tRes.tested("getPositionData()", testResult); - } - - public void _insertDrillDownSheet() - { - boolean testResult = true; - int cellCount = mResultCells.size(); - XSpreadsheets xSheets = xSheetDoc.getSheets(); - XIndexAccess xIA = UnoRuntime.queryInterface( - XIndexAccess.class, xSheets); - int sheetCount = xIA.getCount(); - for (int i = 0; i < cellCount && testResult; ++i) - { - CellAddress addr = mResultCells.get(i); - - Object[][] data = xDPTab2.getDrillDownData(addr); - - // sheet is always inserted at the current sheet position. - xDPTab2.insertDrillDownSheet(addr); - - int newSheetCount = xIA.getCount(); - if (newSheetCount == sheetCount + 1) - { - log.println("drill-down sheet for " + formatCell(addr) + " inserted"); - if (data.length < 2) - { - // There is no data for this result. It should never have - // inserted a drill-down sheet. - log.println("new sheet inserted; however, there is no data for this result"); - testResult = false; - continue; - } - - // Retrieve the object of the sheet just inserted. - XSpreadsheet xSheet = null; - try - { - xSheet = UnoRuntime.queryInterface( - XSpreadsheet.class, xIA.getByIndex(addr.Sheet)); - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(); - throw new StatusException("Failed to get the spreadsheet object.", e); - } - - // Check the integrity of the data on the inserted sheet. - if (!checkDrillDownSheetContent(xSheet, data)) - { - log.println("dataintegrity check on the inserted sheet failed"); - testResult = false; - continue; - } - - log.println(" sheet data integrity check passed"); - - // Remove the sheet just inserted. - - XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xSheet); - String name = xNamed.getName(); - try - { - xSheets.removeByName(name); - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(); - throw new StatusException("Failed to removed the inserted sheet named " + name + ".", e); - } - } - else if (newSheetCount == sheetCount) - { - if (data.length > 1) - { - // There is data for this result. It should have inserted - // a new sheet. - log.println("no new sheet is inserted, despite the data being present."); - testResult = false; - } - } - else - { - log.println("what just happened!?"); - testResult = false; - } - } - - tRes.tested("insertDrillDownSheet()", testResult); - } - - public void _getOutputRangeByType() - { - boolean testResult = false; - - do - { - // Let's make sure this doesn't cause a crash. A range returned for an - // out-of-bound condition is undefined. - try - { - xDPTab2.getOutputRangeByType(-1); - log.println("exception not raised"); - break; - } - catch (IllegalArgumentException e) - { - log.println("exception raised on invalid range type (good)"); - } - - try - { - xDPTab2.getOutputRangeByType(100); - log.println("exception not raised"); - break; - } - catch (IllegalArgumentException e) - { - log.println("exception raised on invalid range type (good)"); - } - - // Check to make sure the whole range is not empty. - if (mRangeWhole.EndColumn - mRangeWhole.StartColumn <= 0 || - mRangeWhole.EndRow - mRangeWhole.EndColumn <= 0) - { - log.println("whole range is empty"); - break; - } - - log.println("whole range is not empty (good)"); - - // Table range must be of equal width with the whole range, and the same - // bottom. - if (mRangeTable.Sheet != mRangeWhole.Sheet || - mRangeTable.StartColumn != mRangeWhole.StartColumn || - mRangeTable.EndColumn != mRangeWhole.EndColumn || - mRangeTable.EndRow != mRangeWhole.EndRow) - { - log.println("table range is incorrect"); - break; - } - - log.println("table range is correct"); - - // Result range must be smaller than the table range, and must share the - // same lower-right corner. - if (mRangeResult.Sheet != mRangeTable.Sheet || - mRangeResult.StartColumn < mRangeTable.StartColumn || - mRangeResult.StartRow < mRangeTable.StartRow || - mRangeResult.EndColumn != mRangeTable.EndColumn || - mRangeResult.EndRow != mRangeTable.EndRow) - break; - - log.println("result range is correct"); - - testResult = true; - } - while (false); - - tRes.tested("getOutputRangeByType()", testResult); - } - - private void printHeaderData(DataPilotTablePositionData posData) - { - DataPilotTableHeaderData header = (DataPilotTableHeaderData)posData.PositionData; - String posType = ""; - if (posData.PositionType == DataPilotTablePositionType.COLUMN_HEADER) - posType = "column header"; - else if (posData.PositionType == DataPilotTablePositionType.ROW_HEADER) - posType = "row header"; - - log.println(posType + "; member name: " + header.MemberName + "; dimension: " + - header.Dimension + "; hierarchy: " + header.Hierarchy + - "; level: " + header.Level); - } - - private void printResultData(DataPilotTablePositionData posData) - { - DataPilotTableResultData resultData = (DataPilotTableResultData)posData.PositionData; - int dataId = resultData.DataFieldIndex; - DataResult res = resultData.Result; - double val = res.Value; - int flags = res.Flags; - int filterCount = resultData.FieldFilters.length; - log.println("result; data field index: " + dataId + "; value: " + val + "; flags: " + flags + - "; filter count: " + filterCount); - - for (int i = 0; i < filterCount; ++i) - { - DataPilotFieldFilter fil = resultData.FieldFilters[i]; - log.println(" field name: " + fil.FieldName + "; match value: " + fil.MatchValue); - } - } - - private String formatCell(CellAddress addr) - { - String str = "(" + addr.Column + "," + addr.Row + ")"; - return str; - } - - private void printRange(String text, CellRangeAddress rangeAddr) - { - log.println(text + ": (" + rangeAddr.StartColumn + "," + rangeAddr.StartRow + ") - (" + - rangeAddr.EndColumn + "," + rangeAddr.EndRow + ")"); - } - - private void buildResultCells() throws ResultCellFailure - { - if (mResultCells != null) - return; - - getOutputRanges(); - - mResultCells = new ArrayList<CellAddress>(); - for (int x = mRangeResult.StartColumn; x <= mRangeResult.EndColumn; ++x) - { - for (int y = mRangeResult.StartRow; y <= mRangeResult.EndRow; ++y) - { - CellAddress addr = new CellAddress(); - addr.Sheet = mRangeResult.Sheet; - addr.Column = x; - addr.Row = y; - DataPilotTablePositionData posData = xDPTab2.getPositionData(addr); - if (posData.PositionType != DataPilotTablePositionType.RESULT) - { - log.println(formatCell(addr) + ": this is not a result cell"); - throw new ResultCellFailure(); - } - mResultCells.add(addr); - } - } - } - - private void buildDataFields() - { - mDataFieldDims = new ArrayList<Integer>(); - XDataPilotDescriptor xDesc = UnoRuntime.queryInterface( - XDataPilotDescriptor.class, xDPTab2); - - XIndexAccess xFields = xDesc.getDataPilotFields(); - int fieldCount = xFields.getCount(); - for (int i = 0; i < fieldCount; ++i) - { - try - { - Object field = xFields.getByIndex(i); - XPropertySet propSet = UnoRuntime.queryInterface( - XPropertySet.class, field); - DataPilotFieldOrientation orient = - (DataPilotFieldOrientation)propSet.getPropertyValue("Orientation"); - if (orient == DataPilotFieldOrientation.DATA) - { - Integer item = Integer.valueOf(i); - mDataFieldDims.add(item); - } - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(log); - throw new StatusException( "Failed to get a field.", e); - } - } - } - - private void getOutputRanges() - { - if (mRangeWhole != null && mRangeTable != null && mRangeResult != null) - return; - - try - { - mRangeWhole = xDPTab2.getOutputRangeByType(DataPilotOutputRangeType.WHOLE); - printRange("whole range ", mRangeWhole); - mRangeTable = xDPTab2.getOutputRangeByType(DataPilotOutputRangeType.TABLE); - printRange("table range ", mRangeTable); - mRangeResult = xDPTab2.getOutputRangeByType(DataPilotOutputRangeType.RESULT); - printRange("result range", mRangeResult); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(log); - throw new StatusException( "Failed to get output range by type.", e); - } - } - - private boolean checkDrillDownSheetContent(XSpreadsheet xSheet, Object[][] data) - { - CellAddress lastCell = getLastUsedCellAddress(xSheet, 0, 0); - if (data.length <= 0 || lastCell == null || lastCell.Row == 0 || lastCell.Column == 0) - { - log.println("empty data condition"); - return false; - } - - if (data.length != lastCell.Row + 1 || data[0].length != lastCell.Column + 1) - { - log.println("data size differs"); - return false; - } - - XCellRange xCR = null; - try - { - xCR = xSheet.getCellRangeByPosition(0, 0, lastCell.Column, lastCell.Row); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - return false; - } - - XCellRangeData xCRD = UnoRuntime.queryInterface( - XCellRangeData.class, xCR); - - Object[][] sheetData = xCRD.getDataArray(); - for (int x = 0; x < sheetData.length; ++x) - { - for (int y = 0; y < sheetData[x].length; ++y) - { - Object cell1 = sheetData[x][y]; - Object cell2 = data[x][y]; - if (AnyConverter.isString(cell1) && AnyConverter.isString(cell2)) - { - String s1 = (String)cell1, s2 = (String)(cell2); - if (!s1.equals(s2)) - { - log.println("string cell values differ"); - return false; - } - } - else if (AnyConverter.isDouble(cell1) && AnyConverter.isDouble(cell2)) - { - double f1 = 0.0, f2 = 0.0; - try - { - f1 = AnyConverter.toDouble(cell1); - f2 = AnyConverter.toDouble(cell2); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - log.println("failed to convert cells to double"); - return false; - } - - if (f1 != f2) - { - log.println("numerical cell values differ"); - return false; - } - } - else - { - log.println("cell types differ"); - return false; - } - } - } - - return true; - } - - private CellAddress getLastUsedCellAddress(XSpreadsheet xSheet, int nCol, int nRow) - { - try - { - XCellRange xRng = xSheet.getCellRangeByPosition(nCol, nRow, nCol, nRow); - XSheetCellRange xSCR = UnoRuntime.queryInterface( - XSheetCellRange.class, xRng); - - XSheetCellCursor xCursor = xSheet.createCursorByRange(xSCR); - XCellCursor xCellCursor = UnoRuntime.queryInterface( - XCellCursor.class, xCursor); - - xCellCursor.gotoEnd(); - XCell xCell = xCursor.getCellByPosition(0, 0); - XCellAddressable xCellAddr = UnoRuntime.queryInterface( - XCellAddressable.class, xCell); - - return xCellAddr.getCellAddress(); - } - catch (com.sun.star.lang.IndexOutOfBoundsException ex) - { - } - return null; - } -} - commit a0bb33bd5d6a9f968ab5e4eadc4692754cff7073 Author: Jens Carl <[email protected]> Date: Fri Aug 11 07:47:05 2017 +0000 tdf#45904 Remove/disable obsolete _XDataPilotDescriptor Java tests The _XDataPilotDescriptor tests are already written in C++ since commit 95780ec73990f96dc16fc677c895d00fa1360008. Change-Id: Id1f219b148dd97455aecda705ad3b388128a0e0c Reviewed-on: https://gerrit.libreoffice.org/41010 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 144a4facba97..10b605ad5c23 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -602,7 +602,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XConsolidationDescriptor \ qadevOOo/tests/java/ifc/sheet/_XDatabaseRange \ qadevOOo/tests/java/ifc/sheet/_XDatabaseRanges \ - qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor \ qadevOOo/tests/java/ifc/sheet/_XDataPilotField \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTable \ qadevOOo/tests/java/ifc/sheet/_XDataPilotTable2 \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv index bab50db1b312..aa831b4632e7 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotTableObj.csv @@ -1,16 +1,5 @@ "ScDataPilotTableObj";"com::sun::star::container::XNamed";"getName()" "ScDataPilotTableObj";"com::sun::star::container::XNamed";"setName()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getTag()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"setTag()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getSourceRange()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"setSourceRange()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getFilterDescriptor()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getDataPilotFields()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getColumnFields()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getRowFields()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getPageFields()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getDataFields()" -"ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotDescriptor";"getHiddenFields()" "ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable";"getOutputRange()" "ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable";"refresh()" "ScDataPilotTableObj";"com::sun::star::sheet::XDataPilotTable2";"getDrillDownData()" diff --git a/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java b/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java deleted file mode 100644 index 06bac330c2c6..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.sheet; - -import lib.MultiMethodTest; -import lib.Status; -import lib.StatusException; - -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XNamed; -import com.sun.star.sheet.DataPilotFieldOrientation; -import com.sun.star.sheet.XDataPilotDescriptor; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.uno.UnoRuntime; - -/** -* Testing <code>com.sun.star.sheet.XDataPilotDescriptor</code> -* interface methods : -* <ul> -* <li><code> getTag()</code></li> -* <li><code> setTag()</code></li> -* <li><code> getSourceRange()</code></li> -* <li><code> setSourceRange()</code></li> -* <li><code> getFilterDescriptor()</code></li> -* <li><code> getDataPilotFields()</code></li> -* <li><code> getColumnFields()</code></li> -* <li><code> getRowFields()</code></li> -* <li><code> getPageFields()</code></li> -* <li><code> getDataFields()</code></li> -* <li><code> getHiddenFields()</code></li> -* </ul> <p> -* This test needs the following object relations : -* <ul> -* <li> <code>'FIELDSAMOUNT'</code> (of type <code>Integer</code>): -* to have number of fields </li> -* <ul> <p> -* @see com.sun.star.sheet.XDataPilotDescriptor -*/ -public class _XDataPilotDescriptor extends MultiMethodTest { - - public XDataPilotDescriptor oObj = null; - CellRangeAddress CRA = new CellRangeAddress((short)1, 1, 1, 5, 5); - String sTag = "XDataPilotDescriptor_Tag"; - String fieldsNames[]; - int fieldsAmount = 0; - int tEnvFieldsAmount = 0; - - /** - * Retrieves object relations. - * @throws StatusException If one of relations not found. - */ - @Override - protected void before() { - Integer amount = (Integer)tEnv.getObjRelation("FIELDSAMOUNT"); - if (amount == null) throw new StatusException(Status.failed - ("Relation 'FIELDSAMOUNT' not found")); - tEnvFieldsAmount = amount.intValue(); - } - - /** - * Test calls the method and compares returned value with value that was set - * in method <code>setSourceRange()</code>. <p> - * Has <b> OK </b> status if all fields of cell range addresses are equal. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> setSourceRange() </code> : to have current source range </li> - * </ul> - */ - public void _getSourceRange(){ - requiredMethod("setSourceRange()"); - boolean bResult = true; - - CellRangeAddress objRA = oObj.getSourceRange(); - bResult &= objRA.Sheet == CRA.Sheet; - bResult &= objRA.StartRow == CRA.StartRow; - bResult &= objRA.StartColumn == CRA.StartColumn; - bResult &= objRA.EndRow == CRA.EndRow; - bResult &= objRA.EndColumn == CRA.EndColumn; - - tRes.tested("getSourceRange()", bResult); - } - - /** - * Test gets the current source range, stores it and sets new source range.<p> - * Has <b> OK </b> status if the method successfully returns. <p> - * The following method tests are to be executed before : - * <ul> - * <li> <code> getColumnFields() </code> </li> - * <li> <code> getRowFields() </code> </li> - * <li> <code> getDataFields() </code> </li> - * <li> <code> getHiddenFields() </code> </li> - * <li> <code> getPageFields() </code> </li> - * </ul> - */ - public void _setSourceRange(){ - executeMethod("getColumnFields()") ; - executeMethod("getRowFields()") ; - executeMethod("getDataFields()") ; - executeMethod("getHiddenFields()") ; - executeMethod("getPageFields()") ; - - oObj.getSourceRange(); - oObj.setSourceRange(CRA); - - tRes.tested("setSourceRange()", true); - } - - /** - * Test calls the method and checks returned value with value that was set - * by method <code>setTag()</code>. <p> - * Has <b> OK </b> status if returned value is equal to value that was set - * by method <code>setTag()</code>. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> setTag() </code> : to have current tag </li> - * </ul> - */ - public void _getTag(){ - requiredMethod("setTag()"); - boolean bResult = true; - - String objTag = oObj.getTag(); - bResult &= objTag.equals(sTag); - - tRes.tested("getTag()", bResult); - } - - /** - * Test just calls the method. <p> - * Has <b> OK </b> status if the method successfully returns. <p> - */ - public void _setTag(){ - oObj.setTag(sTag); - tRes.tested("setTag()", true); - } - - /** - * Test calls the method , checks returned value, compares - * number of fields goten from returned value and obtained by object - * relation <code>'FIELDSAMOUNT'</code> and set property - * <code>Orientation</code> to one of DataPilotFieldOrientation values. <p> - * 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> - */ - public void _getDataPilotFields(){ - boolean bResult = true; - XIndexAccess IA = null; - - IA = oObj.getDataPilotFields(); - if (IA == null) { - log.println("Returned value is null."); - tRes.tested("getDataPilotFields()", false); - return; - } else {log.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."); - tRes.tested("getDataPilotFields()", false); - return; - } else {log.println("count of returned fields -- OK");} - - fieldsNames = new String[tEnvFieldsAmount]; - int i = -1 ; - int cnt = 0 ; - while (++i < fieldsAmount) { - Object field; - try { - field = IA.getByIndex(i); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } - - XNamed named = UnoRuntime.queryInterface(XNamed.class, field); - String name = named.getName(); - - log.print("Field : '" + name + "' ... ") ; - - if (!name.equals("Data")) { - - fieldsNames[cnt] = name ; - - XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, field); - - try { - switch (cnt % 5) { - case 0 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.COLUMN); - log.println(" Column") ; - break; - case 1 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.ROW); - log.println(" Row") ; - break; - case 2 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.DATA); - log.println(" Data") ; - break; - case 3 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.HIDDEN); - log.println(" Hidden") ; - break; - case 4 : - props.setPropertyValue("Orientation", - DataPilotFieldOrientation.PAGE); - log.println(" Page") ; - break; - } } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - tRes.tested("getDataPilotFields()", false); - return; - } - if (++cnt > 4) break; - } else { - tRes.tested("getDataPilotFields()", false); - return; - } - } - - tRes.tested("getDataPilotFields()", bResult); - } - - /** - * Test calls the method and checks returned collection using the method - * <code>CheckNames()</code>. <p> - * Has <b> OK </b> status if the method <code>CheckNames()</code> returns true - * and no exceptions were thrown. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getDataPilotFields() </code> : to have array of field names </li> - * </ul> - */ - public void _getColumnFields(){ - requiredMethod("getDataPilotFields()"); - XIndexAccess IA = oObj.getColumnFields(); - boolean bResult = CheckNames(IA, 0); - tRes.tested("getColumnFields()", bResult); - } - - /** - * Test calls the method and checks returned collection using the method - * <code>CheckNames()</code>. <p> - * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true - * and no exceptions were thrown. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getDataPilotFields() </code> : to have array of field names </li> - * </ul> - */ - public void _getDataFields(){ - requiredMethod("getDataPilotFields()"); - XIndexAccess IA = oObj.getDataFields(); - boolean bResult = CheckNames(IA, 2); - tRes.tested("getDataFields()", bResult); - } - - /** - * Test calls the method and checks returned collection using the method - * <code>CheckNames()</code>. <p> - * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true - * and no exceptions were thrown. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getDataPilotFields() </code> : to have array of field names </li> - * </ul> - */ - public void _getHiddenFields(){ - requiredMethod("getDataPilotFields()"); - XIndexAccess IA = oObj.getHiddenFields(); - boolean bResult = CheckNames(IA, 3); - tRes.tested("getHiddenFields()", bResult); - } - - /** - * Test calls the method and checks returned collection using the method - * <code>CheckNames()</code>. <p> - * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true - * and no exceptions were thrown. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getDataPilotFields() </code> : to have array of field names </li> - * </ul> - */ - public void _getRowFields(){ - requiredMethod("getDataPilotFields()"); - XIndexAccess IA = oObj.getRowFields(); - boolean bResult = CheckNames(IA, 1); - tRes.tested("getRowFields()", bResult); - } - - /** - * setting of PageFields isn't supported by StarOffice Calc - * Has <b> OK </b> status if the returned IndexAccess - * isn't NULL. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getDataPilotFields() </code> : to have array of field names </li> - * </ul> - */ - public void _getPageFields(){ - requiredMethod("getDataPilotFields()"); - XIndexAccess IA = oObj.getPageFields(); - boolean bResult = (IA != null); - tRes.tested("getPageFields()", bResult); - } - - /** - * 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> - */ - public void _getFilterDescriptor(){ - boolean bResult = oObj.getFilterDescriptor() != null; - tRes.tested("getFilterDescriptor()", bResult); - } - - /** - * Method checks that the field with index <code>rem</code> exists - * in the array <code>IA</code>. - * @param IA collection of elements that support interface <code>XNamed</code> - * @param rem index of field in the array of field names that was stored in - * the method <code>getDataPilotFields()</code> - * @return true if required field name exists in passed collection; - * false otherwise - * @see com.sun.star.container.XNamed - */ - boolean CheckNames(XIndexAccess IA, int rem) { - String name = null; - - if (IA == null) { - log.println("Null retruned.") ; - return false ; - } - - if (fieldsNames[rem] == null) { - log.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 '" - + fieldsNames[rem] + "'") ; - return false ; - } - - try { - log.print("Fields returned ") ; - for (int i = 0; i < IA.getCount(); i++) { - Object field = IA.getByIndex(i); - XNamed named = UnoRuntime.queryInterface - (XNamed.class, field); - name = named.getName(); - log.print(" " + name) ; - if (fieldsNames[rem].equals(name)) { - log.println(" - OK") ; - return true ; - } - } - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - return false ; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log) ; - return false ; - } - log.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; - return false ; - } - - /** - * Recreates object(to back old orientations of the fields). - */ - @Override - protected void after() { - disposeEnvironment(); - } -} - _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
