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

tdf#45904 Move _SubTotalDescriptor Java tests to C++

Change-Id: Id4265dd6a8123624bccdfe343655525948cadee7
Reviewed-on: https://gerrit.libreoffice.org/47623Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst acb43c0b
/* -*- 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_SUBTOTALDESCRIPTOR_HXX
#define INCLUDED_TEST_SHEET_SUBTOTALDESCRIPTOR_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 SubTotalDescriptor
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
void testSubTotalDescriptorProperties();
protected:
~SubTotalDescriptor() {}
};
}
#endif // INCLUDED_TEST_SHEET_SUBTOTALDESCRIPTOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -576,7 +576,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocument \
qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings \
qadevOOo/tests/java/ifc/sheet/_SpreadsheetViewSettings \
qadevOOo/tests/java/ifc/sheet/_SubTotalDescriptor \
qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \
qadevOOo/tests/java/ifc/sheet/_XActivationBroadcaster \
qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \
......
......@@ -2,14 +2,6 @@
"ScSubTotalDescriptorBase";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScSubTotalDescriptorBase";"com::sun::star::container::XElementAccess";"getElementType()"
"ScSubTotalDescriptorBase";"com::sun::star::container::XElementAccess";"hasElements()"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"InsertPageBreaks"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"IsCaseSensitive"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"EnableUserSortList"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"UserSortListIndex"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"BindFormatsToContent"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"EnableSort"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"SortAscending"
"ScSubTotalDescriptorBase";"com::sun::star::sheet::SubTotalDescriptor";"MaxFieldCount"
"ScSubTotalDescriptorBase";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
"ScSubTotalDescriptorBase";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
"ScSubTotalDescriptorBase";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
......
/*
* 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.SubTotalDescriptor</code>
* service properties :
* <ul>
* <li><code> InsertPageBreaks</code></li>
* <li><code> IsCaseSensitive</code></li>
* <li><code> EnableUserSortList</code></li>
* <li><code> UserSortListIndex</code></li>
* <li><code> BindFormatsToContent</code></li>
* <li><code> SortAscending</code></li>
* <li><code> MaxFieldCount</code></li>
* </ul> <p>
* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
* @see com.sun.star.sheet.SubTotalDescriptor
*/
public class _SubTotalDescriptor extends MultiPropertyTest {
} // finish class _SubTotalDescriptor
......@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/subtotaldescriptor.hxx>
#include <test/sheet/xsubtotaldescriptor.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
......@@ -30,9 +31,11 @@ using namespace com::sun::star;
namespace sc_apitest {
#define NUMBER_OF_TESTS 2
#define NUMBER_OF_TESTS 3
class ScSubTotalDescriptorBaseObj : public CalcUnoApiTest, public apitest::XSubTotalDescriptor
class ScSubTotalDescriptorBaseObj : public CalcUnoApiTest,
public apitest::SubTotalDescriptor,
public apitest::XSubTotalDescriptor
{
public:
ScSubTotalDescriptorBaseObj();
......@@ -43,6 +46,9 @@ public:
CPPUNIT_TEST_SUITE(ScSubTotalDescriptorBaseObj);
// SubTotalDescriptor
CPPUNIT_TEST(testSubTotalDescriptorProperties);
// XSubTotalDescriptor
CPPUNIT_TEST(testAddNew);
CPPUNIT_TEST(testClear);
......
......@@ -50,6 +50,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/datapilotitem \
test/source/sheet/documentsettings \
test/source/sheet/scenario \
test/source/sheet/subtotaldescriptor \
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/sheet/subtotaldescriptor.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace com::sun::star;
using namespace com::sun::star::uno;
namespace apitest
{
void SubTotalDescriptor::testSubTotalDescriptorProperties()
{
uno::Reference<beans::XPropertySet> xSubTotalDescriptor(init(), UNO_QUERY_THROW);
OUString propName;
uno::Any aNewValue;
propName = "InsertPageBreaks";
bool aInsertPageBreaks = true;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aInsertPageBreaks);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue InsertPageBreaks", !aInsertPageBreaks);
aNewValue <<= true;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aInsertPageBreaks);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue InsertPageBreaks", aInsertPageBreaks);
propName = "IsCaseSensitive";
bool aIsCaseSensitive = true;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aIsCaseSensitive);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsCaseSensitive", !aIsCaseSensitive);
aNewValue <<= true;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aIsCaseSensitive);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsCaseSensitive", aIsCaseSensitive);
propName = "EnableUserSortList";
bool aEnableUserSortList = true;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableUserSortList);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue EnableUserSortList", !aEnableUserSortList);
aNewValue <<= true;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableUserSortList);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue EnableUserSortList", aEnableUserSortList);
propName = "UserSortListIndex";
sal_Int32 aUserSortListIndex = 42;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aUserSortListIndex);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue UserSortListIndex", sal_Int32(0),
aUserSortListIndex);
aNewValue <<= sal_Int32(42);
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aUserSortListIndex);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UserSortListIndex", sal_Int32(42),
aUserSortListIndex);
propName = "BindFormatsToContent";
bool aBindFormatsToContent = true;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aBindFormatsToContent);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue BindFormatsToContent",
!aBindFormatsToContent);
aNewValue <<= true;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aBindFormatsToContent);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue BindFormatsToContent",
aBindFormatsToContent);
propName = "EnableSort";
bool aEnableSort = false;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableSort);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue EnableSort", aEnableSort);
aNewValue <<= false;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableSort);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue EnableSort", !aEnableSort);
propName = "SortAscending";
bool aSortAscending = false;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aSortAscending);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SortAscending", aSortAscending);
aNewValue <<= false;
xSubTotalDescriptor->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aSortAscending);
CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue SortAscending", !aSortAscending);
propName = "MaxFieldCount";
sal_Int32 aMaxFieldCount = 42;
CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aMaxFieldCount);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue MaxFieldCount", sal_Int32(3),
aMaxFieldCount);
aNewValue <<= sal_Int32(42);
CPPUNIT_ASSERT_THROW_MESSAGE("Able to change PropertyValue MaxFieldCount",
xSubTotalDescriptor->setPropertyValue(propName, aNewValue),
lang::IllegalArgumentException);
}
}
/* 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