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

tdf#45904 Move _SheetCellRange Java tests to C++

Change-Id: Ia4ebe9d0418e33d245437a49c7ce9551b4a06e82
Reviewed-on: https://gerrit.libreoffice.org/49124Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 7eb24dc1
/* -*- 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_SHEETCELLRANGE_HXX
#define INCLUDED_TEST_SHEET_SHEETCELLRANGE_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 SheetCellRange
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
void testSheetCellRangeProperties();
protected:
~SheetCellRange() {}
};
}
#endif // INCLUDED_TEST_SHEET_SHEETCELLRANGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -565,7 +565,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster \
qadevOOo/tests/java/ifc/sheet/_FunctionDescription \
qadevOOo/tests/java/ifc/sheet/_Shape \
qadevOOo/tests/java/ifc/sheet/_SheetCellRange \
qadevOOo/tests/java/ifc/sheet/_SheetCellRanges \
qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor \
qadevOOo/tests/java/ifc/sheet/_SheetLink \
......
......@@ -133,12 +133,6 @@
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Validation"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional"
"ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()"
"ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()"
"ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()"
......
......@@ -128,12 +128,6 @@
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Validation"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional"
"ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()"
"ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()"
"ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()"
......
......@@ -140,12 +140,6 @@
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Validation"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional"
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()"
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()"
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()"
......
/*
* 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.MultiPropertyTest;
/**
* Testing <code>com.sun.star.sheet.SheetCellRange</code>
* service properties :
* <ul>
* <li><code> Position</code></li>
* <li><code> Size</code></li>
* </ul> <p>
* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
* @see com.sun.star.sheet.SheetCellRange
*/
public class _SheetCellRange extends MultiPropertyTest {
} // finish class _SheetCellRange
......@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/sheetcellrange.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellseries.hxx>
......@@ -29,7 +30,8 @@ using namespace css::uno;
namespace sc_apitest {
class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellFormatRangesSupplier,
class ScCellCursorObj : public CalcUnoApiTest, public apitest::SheetCellRange,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellSeries,
public apitest::XMultipleOperation,
......@@ -51,6 +53,9 @@ public:
CPPUNIT_TEST_SUITE(ScCellCursorObj);
// SheetCellRange
CPPUNIT_TEST(testSheetCellRangeProperties);
// XUsedAreaCursor
CPPUNIT_TEST(testGotoStartOfUsedArea);
CPPUNIT_TEST(testGotoEndOfUsedArea);
......
......@@ -9,6 +9,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/cellproperties.hxx>
#include <test/sheet/sheetcellrange.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellrangedata.hxx>
......@@ -47,6 +48,7 @@ using namespace css::uno;
namespace sc_apitest {
class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
public apitest::SheetCellRange,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellRangeData,
......@@ -78,6 +80,9 @@ public:
CPPUNIT_TEST(testVertJustify);
CPPUNIT_TEST(testRotateReference);
// SheetCellRange
CPPUNIT_TEST(testSheetCellRangeProperties);
// XCellFormatRangesSupplier
CPPUNIT_TEST(testGetCellFormatRanges);
......
......@@ -9,6 +9,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/scenario.hxx>
#include <test/sheet/sheetcellrange.hxx>
#include <test/sheet/xcellformatrangessupplier.hxx>
#include <test/sheet/xcellrangeaddressable.hxx>
#include <test/sheet/xcellseries.hxx>
......@@ -43,6 +44,7 @@ namespace sc_apitest
{
class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario,
public apitest::SheetCellRange,
public apitest::XCellFormatRangesSupplier,
public apitest::XCellRangeAddressable,
public apitest::XCellSeries,
......@@ -82,6 +84,9 @@ public:
// Scenario
CPPUNIT_TEST(testScenarioProperties);
// SheetCellRange
CPPUNIT_TEST(testSheetCellRangeProperties);
// XCellFormatRangesSupplier
CPPUNIT_TEST(testGetCellFormatRanges);
......
......@@ -54,6 +54,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/spreadsheetviewsettings \
test/source/sheet/subtotaldescriptor \
test/source/sheet/sheetcell \
test/source/sheet/sheetcellrange \
test/source/sheet/tableautoformat \
test/source/sheet/tablevalidation \
test/source/sheet/xarealink \
......
/* -*- 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/cppunitasserthelper.hxx>
#include <test/sheet/sheetcellrange.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/ValidationType.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
#include <com/sun/star/uno/Any.hxx>
#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 SheetCellRange::testSheetCellRangeProperties()
{
uno::Reference<beans::XPropertySet> xSheetCellRange(init(), UNO_QUERY_THROW);
OUString propName;
uno::Any aNewValue;
propName = "Position";
awt::Point aPositionGet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Position",
xSheetCellRange->getPropertyValue(propName) >>= aPositionGet);
awt::Point aPositionSet(42, 42);
aNewValue <<= aPositionSet;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aPositionSet);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Position", aPositionGet, aPositionGet);
propName = "Size";
awt::Size aSizeGet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Size",
xSheetCellRange->getPropertyValue(propName) >>= aSizeGet);
awt::Size aSizeSet(42, 42);
aNewValue <<= aSizeGet;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aSizeSet);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Size", aSizeGet, aSizeSet);
uno::Sequence<beans::PropertyValue> aPropValue(1);
aPropValue[0].Name = "StyleName";
aPropValue[0].Value <<= OUString("Result2");
propName = "ConditionalFormat";
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatGet;
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatSet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormat",
xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatGet);
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatNew(aConditionalFormatGet,
UNO_QUERY_THROW);
aConditionalFormatNew->addNew(aPropValue);
aNewValue <<= aConditionalFormatNew;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatSet);
for (auto i = 0; i < aConditionalFormatSet->getCount(); i++)
{
uno::Reference<sheet::XSheetConditionalEntry> xSCENew(aConditionalFormatNew->getByIndex(i),
UNO_QUERY_THROW);
uno::Reference<sheet::XSheetConditionalEntry> xSCESet(aConditionalFormatSet->getByIndex(i),
UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormat["
+ std::to_string(i) + "]",
xSCENew->getStyleName(), xSCESet->getStyleName());
}
propName = "ConditionalFormatLocal";
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalGet;
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalSet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormatLocal",
xSheetCellRange->getPropertyValue(propName)
>>= aConditionalFormatLocalGet);
uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew(
aConditionalFormatLocalGet, UNO_QUERY_THROW);
aConditionalFormatLocalNew->addNew(aPropValue);
aNewValue <<= aConditionalFormatLocalNew;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatLocalSet);
for (auto i = 0; i < aConditionalFormatLocalSet->getCount(); i++)
{
uno::Reference<sheet::XSheetConditionalEntry> xSCENew(
aConditionalFormatLocalNew->getByIndex(i), UNO_QUERY_THROW);
uno::Reference<sheet::XSheetConditionalEntry> xSCESet(
aConditionalFormatLocalSet->getByIndex(i), UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormatLocal["
+ std::to_string(i) + "]",
xSCENew->getStyleName(), xSCESet->getStyleName());
}
propName = "Validation";
uno::Reference<beans::XPropertySet> aValidationGet;
uno::Reference<beans::XPropertySet> aValidationSet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Validation",
xSheetCellRange->getPropertyValue(propName) >>= aValidationGet);
uno::Reference<beans::XPropertySet> aValidationNew(aValidationGet, UNO_QUERY_THROW);
uno::Any aValidationType;
aValidationType <<= sheet::ValidationType_WHOLE;
aValidationNew->setPropertyValue("Type", aValidationType);
aNewValue <<= aValidationNew;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aValidationSet);
sheet::ValidationType aType;
aValidationSet->getPropertyValue("Type") >>= aType;
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Validation",
sheet::ValidationType_WHOLE, aType);
propName = "ValidationLocal";
uno::Reference<beans::XPropertySet> aValidationLocalGet;
uno::Reference<beans::XPropertySet> aValidationLocalSet;
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ValidationLocal",
xSheetCellRange->getPropertyValue(propName) >>= aValidationLocalGet);
uno::Reference<beans::XPropertySet> aValidationLocalNew(aValidationLocalGet, UNO_QUERY_THROW);
aValidationType <<= sheet::ValidationType_WHOLE;
aValidationLocalNew->setPropertyValue("Type", aValidationType);
aNewValue <<= aValidationLocalNew;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aValidationLocalSet);
aValidationLocalSet->getPropertyValue("Type") >>= aType;
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ValidationLocal",
sheet::ValidationType_WHOLE, aType);
propName = "AbsoluteName";
OUString aAbsoluteNameGet = "";
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue AbsoluteName",
xSheetCellRange->getPropertyValue(propName) >>= aAbsoluteNameGet);
OUString aAbsoluteNameSet = "$Sheet1.$C$3";
aNewValue <<= aAbsoluteNameSet;
xSheetCellRange->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aAbsoluteNameSet);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue AbsoluteName", aAbsoluteNameGet,
aAbsoluteNameSet);
}
}
/* 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