Kaydet (Commit) a7fc11be authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move _XCellRangeFormula Java tests to C++

Change-Id: Iff5ca30e47a3a3eee704ad9aefdf61b3fcd72f5d
Reviewed-on: https://gerrit.libreoffice.org/52286Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 925a6a99
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#ifndef INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
#define INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
namespace apitest
{
class OOO_DLLPUBLIC_TEST XCellRangeFormula
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
void testGetSetFormulaArray();
protected:
~XCellRangeFormula() {}
};
} // namespace apitest
#endif // INCLUDED_TEST_SHEET_XCELLRANGEFORMULA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -567,7 +567,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocument \
qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \
qadevOOo/tests/java/ifc/sheet/_XCellRangeData \
qadevOOo/tests/java/ifc/sheet/_XCellRangeFormula \
qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement \
qadevOOo/tests/java/ifc/sheet/_XCellRangeReferrer \
qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery \
......
......@@ -116,8 +116,6 @@
"ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharLocaleComplex"
"ScCellCursorObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
"ScCellCursorObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
"ScCellCursorObj";"com::sun::star::sheet::XCellRangeFormula#optional";"getFormulaArray()"
"ScCellCursorObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
"ScCellCursorObj";"com::sun::star::util::XIndent";"decrementIndent()"
"ScCellCursorObj";"com::sun::star::util::XIndent";"incrementIndent()"
"ScCellCursorObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
......
......@@ -111,8 +111,6 @@
"ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharLocaleComplex"
"ScCellRangeObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
"ScCellRangeObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
"ScCellRangeObj";"com::sun::star::sheet::XCellRangeFormula#optional";"getFormulaArray()"
"ScCellRangeObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
"ScCellRangeObj";"com::sun::star::util::XIndent";"decrementIndent()"
"ScCellRangeObj";"com::sun::star::util::XIndent";"incrementIndent()"
"ScCellRangeObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
......
......@@ -114,8 +114,6 @@
"ScTableSheetObj";"com::sun::star::util::XProtectable";"isProtected()"
"ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
"ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangeFormula#optional";"getFormulaArray()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
"ScTableSheetObj";"com::sun::star::util::XIndent";"decrementIndent()"
"ScTableSheetObj";"com::sun::star::util::XIndent";"incrementIndent()"
"ScTableSheetObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
......
/*
* 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 com.sun.star.sheet.XCellRangeFormula;
public class _XCellRangeFormula extends lib.MultiMethodTest {
public XCellRangeFormula oObj = null;
public String[][] orgValue = null;
public void _getFormulaArray() {
Object noArray = tEnv.getObjRelation("noArray");
if (noArray != null) {
log.println("Component " + noArray.toString() +
" doesn't really support this Interface");
log.println("It doesn't make sense to get an FormulaArray from"
+ " the whole sheet");
tRes.tested("getFormulaArray()", true);
return;
}
orgValue = oObj.getFormulaArray();
String[][] newValue = oObj.getFormulaArray();
newValue[0][0] = "inserted";
oObj.setFormulaArray(newValue);
boolean res = oObj.getFormulaArray()[0][0].equals(newValue[0][0]);
tRes.tested("getFormulaArray()",res);
}
public void _setFormulaArray() {
requiredMethod("getFormulaArray()");
Object noArray = tEnv.getObjRelation("noArray");
if (noArray != null) {
log.println("Component " + noArray.toString() +
" doesn't really support this Interface");
log.println("It doesn't make sense to set an FormulaArray over"
+ " the whole sheet");
tRes.tested("setFormulaArray()", true);
return;
}
oObj.setFormulaArray(orgValue);
boolean res = oObj.getFormulaArray()[0][0].equals(orgValue[0][0]);
tRes.tested("setFormulaArray()",res);
}
}
......@@ -12,6 +12,7 @@
#include <test/sheet/xarrayformularange.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellrangeformula.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xmultipleoperation.hxx>
#include <test/sheet/xsheetcellrange.hxx>
......@@ -35,6 +36,7 @@ class ScCellCursorObj : public CalcUnoApiTest, public apitest::SheetCellRange,
public apitest::XArrayFormulaRange,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellRangeFormula,
public apitest::XCellSeries,
public apitest::XMultipleOperation,
public apitest::XSheetCellRange,
......@@ -61,19 +63,22 @@ public:
// XArrayFormulaRange
CPPUNIT_TEST(testGetSetArrayFormula);
// XMultipleOperation
CPPUNIT_TEST(testSetTableOperation);
// XCellFormatRangesSupplier
CPPUNIT_TEST(testGetCellFormatRanges);
// XCellRangeAddressable
CPPUNIT_TEST(testGetRangeAddress);
// XCellRangeFormula
CPPUNIT_TEST(testGetSetFormulaArray);
// XCellSeries
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
// XMultipleOperation
CPPUNIT_TEST(testSetTableOperation);
// XSheetCellRange
CPPUNIT_TEST(testGetSpreadsheet);
......
......@@ -14,6 +14,7 @@
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellrangedata.hxx>
#include <test/sheet/xcellrangeformula.hxx>
#include <test/sheet/xcellrangesquery.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xmultipleoperation.hxx>
......@@ -54,6 +55,7 @@ class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellRangeData,
public apitest::XCellRangeFormula,
public apitest::XCellRangesQuery,
public apitest::XCellSeries,
public apitest::XMultipleOperation,
......@@ -91,10 +93,6 @@ public:
// XCellFormatRangesSupplier
CPPUNIT_TEST(testGetCellFormatRanges);
// XCellSeries
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
// XCellRangeAddressable
CPPUNIT_TEST(testGetRangeAddress);
......@@ -102,6 +100,9 @@ public:
CPPUNIT_TEST(testGetDataArray);
CPPUNIT_TEST(testSetDataArray);
// XCellRangeFormula
CPPUNIT_TEST(testGetSetFormulaArray);
// XCellRangesQuery
CPPUNIT_TEST(testQueryColumnDifference);
CPPUNIT_TEST(testQueryContentDifference);
......@@ -111,22 +112,27 @@ public:
CPPUNIT_TEST(testQueryRowDifference);
CPPUNIT_TEST(testQueryVisibleCells);
// XSearchable
CPPUNIT_TEST(testFindAll);
CPPUNIT_TEST(testFindFirst);
// XCellSeries
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
// XMultipleOperation
CPPUNIT_TEST(testSetTableOperation);
// XSheetCellRange
CPPUNIT_TEST(testGetSpreadsheet);
// XReplaceable
CPPUNIT_TEST(testReplaceAll);
CPPUNIT_TEST(testCreateReplaceDescriptor);
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
// XSearchable
CPPUNIT_TEST(testFindAll);
CPPUNIT_TEST(testFindFirst);
// XSheetCellRange
CPPUNIT_TEST(testGetSpreadsheet);
// XSheetFilterable
CPPUNIT_TEST(testCreateFilterDescriptor);
CPPUNIT_TEST(testFilter);
// XSheetFilterableEx
CPPUNIT_TEST(testCreateFilterDescriptorByObject);
......@@ -139,11 +145,10 @@ public:
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
CPPUNIT_TEST(testSortOOB);
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
// XSheetFilterable (has to be last tests; otherwise it'll crash)
CPPUNIT_TEST(testCreateFilterDescriptor);
CPPUNIT_TEST(testFilter);
CPPUNIT_TEST(testSortOOB);
CPPUNIT_TEST_SUITE_END();
......
......@@ -14,6 +14,7 @@
#include <test/sheet/xarrayformularange.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellrangeformula.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xdatapilottablessupplier.hxx>
#include <test/sheet/xmultipleoperation.hxx>
......@@ -51,6 +52,7 @@ class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario,
public apitest::XArrayFormulaRange,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellRangeFormula,
public apitest::XCellSeries,
public apitest::XDataPilotTablesSupplier,
public apitest::XMultipleOperation,
......@@ -106,6 +108,11 @@ public:
// XCellRangeAddressable
CPPUNIT_TEST(testGetRangeAddress);
// XCellRangeFormula
#if 0 // disable, because it makes no sense to set an FormulaArray over the whole sheet
CPPUNIT_TEST(testGetSetFormulaArray);
#endif
// XCellSeries
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
......
......@@ -77,6 +77,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xcelladdressable \
test/source/sheet/xcellformatrangessupplier \
test/source/sheet/xcellrangeaddressable \
test/source/sheet/xcellrangeformula \
test/source/sheet/xcellrangedata \
test/source/sheet/xcellrangereferrer \
test/source/sheet/xcellrangesquery \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#include <test/sheet/xcellrangeformula.hxx>
#include <com/sun/star/sheet/XCellRangeFormula.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace com::sun::star;
using namespace com::sun::star::uno;
namespace apitest
{
void XCellRangeFormula::testGetSetFormulaArray()
{
uno::Reference<sheet::XCellRangeFormula> xCRF(init(), UNO_QUERY_THROW);
uno::Sequence<uno::Sequence<OUString>> aFormulaArrayOrginal = xCRF->getFormulaArray();
uno::Sequence<uno::Sequence<OUString>> aFormulaArrayNew = xCRF->getFormulaArray();
aFormulaArrayNew[0][0] = "NewValue";
xCRF->setFormulaArray(aFormulaArrayNew);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get new FormulaArray", OUString("NewValue"),
xCRF->getFormulaArray()[0][0]);
xCRF->setFormulaArray(aFormulaArrayOrginal);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set new FormulaArray", aFormulaArrayOrginal[0][0],
xCRF->getFormulaArray()[0][0]);
}
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment