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

tdf#45904 Move _TableAutoFormat Java tests to C++

Change-Id: Ib26a2d2a05d926a0d031c86812456996cb368792
Reviewed-on: https://gerrit.libreoffice.org/47361Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst b0ab92ea
/* -*- 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_TABLEAUTOFORMAT_HXX
#define INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_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 TableAutoFormat
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
void testTableAutoFormatProperties();
protected:
~TableAutoFormat() {}
};
}
#endif // INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -579,7 +579,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings \
qadevOOo/tests/java/ifc/sheet/_SpreadsheetViewSettings \
qadevOOo/tests/java/ifc/sheet/_SubTotalDescriptor \
qadevOOo/tests/java/ifc/sheet/_TableAutoFormat \
qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \
qadevOOo/tests/java/ifc/sheet/_XActivationBroadcaster \
qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \
......
"ScAutoFormatObj";"com::sun::star::container::XIndexAccess";"getCount()"
"ScAutoFormatObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeFont"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeJustify"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeBorder"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeBackground"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeNumberFormat"
"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeWidthAndHeight"
"ScAutoFormatObj";"com::sun::star::container::XElementAccess";"getElementType()"
"ScAutoFormatObj";"com::sun::star::container::XElementAccess";"hasElements()"
"ScAutoFormatObj";"com::sun::star::container::XNamed";"getName()"
......
/*
* 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.TableAutoFormat</code>
* service properties :
* <ul>
* <li><code> IncludeFont</code></li>
* <li><code> IncludeJustify</code></li>
* <li><code> IncludeBorder</code></li>
* <li><code> IncludeBackground</code></li>
* <li><code> IncludeNumberFormat</code></li>
* <li><code> IncludeWidthAndHeight</code></li>
* </ul> <p>
* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
* @see com.sun.star.sheet.TableAutoFormat
*/
public class _TableAutoFormat extends MultiPropertyTest {
} // finish class _TableAutoFormat
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# 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/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sc_autoformatobj))
$(eval $(call gb_CppunitTest_use_external,sc_autoformatobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_autoformatobj, \
sc/qa/extras/scautoformatobj \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_autoformatobj, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sb \
sc \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \
svxcore \
test \
tk \
tl \
ucbhelper \
unotest \
utl \
vbahelper \
vcl \
xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_autoformatobj,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_autoformatobj))
$(eval $(call gb_CppunitTest_use_ure,sc_autoformatobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_autoformatobj))
$(eval $(call gb_CppunitTest_use_components,sc_autoformatobj,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
scripting/source/basprov/basprov \
scripting/util/scriptframe \
sc/util/sc \
sc/util/scd \
sc/util/scfilt \
$(call gb_Helper_optional,SCRIPTING, \
sc/util/vbaobj) \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
uui/util/uui \
xmloff/util/xo \
svtools/util/svt \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_autoformatobj))
# vim: set noet sw=4 ts=4:
......@@ -148,6 +148,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_databaserangesobj \
CppunitTest_sc_consolidationdescriptorobj \
CppunitTest_sc_chart2dataprovider \
CppunitTest_sc_autoformatobj \
))
$(eval $(call gb_Module_add_perfcheck_targets,sc,\
......
/* -*- 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/calc_unoapi_test.hxx>
#include <test/sheet/tableautoformat.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
using namespace css;
using namespace css::uno;
using namespace com::sun::star;
namespace sc_apitest
{
#define NUMBER_OF_TESTS 1
class ScTableAutoFormatObj : public CalcUnoApiTest, public apitest::TableAutoFormat
{
public:
ScTableAutoFormatObj();
virtual uno::Reference<uno::XInterface> init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScTableAutoFormatObj);
// TableAutoFormat
CPPUNIT_TEST(testTableAutoFormatProperties);
CPPUNIT_TEST_SUITE_END();
private:
static sal_Int32 nTest;
static uno::Reference<lang::XComponent> mxComponent;
};
sal_Int32 ScTableAutoFormatObj::nTest = 0;
uno::Reference<lang::XComponent> ScTableAutoFormatObj::mxComponent;
ScTableAutoFormatObj::ScTableAutoFormatObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
{
}
uno::Reference<uno::XInterface> ScTableAutoFormatObj::init()
{
// create a calc document
if (!mxComponent.is())
mxComponent = loadFromDesktop("private:factory/scalc");
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIA(
xMSF->createInstance("com.sun.star.sheet.TableAutoFormats"), UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xTableAutoFormat(xIA->getByIndex(xIA->getCount() - 1),
UNO_QUERY_THROW);
return xTableAutoFormat;
}
void ScTableAutoFormatObj::setUp()
{
nTest++;
CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
CalcUnoApiTest::setUp();
}
void ScTableAutoFormatObj::tearDown()
{
if (nTest == NUMBER_OF_TESTS)
{
closeDocument(mxComponent);
mxComponent.clear();
}
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTableAutoFormatObj);
} // end namespace
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/datapilotfield \
test/source/sheet/datapilotitem \
test/source/sheet/scenario \
test/source/sheet/tableautoformat \
test/source/sheet/tablevalidation \
test/source/sheet/xarealink \
test/source/sheet/xarealinks \
......
/* -*- 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/tableautoformat.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 TableAutoFormat::testTableAutoFormatProperties()
{
uno::Reference<beans::XPropertySet> xTableAutoFormat(init(), UNO_QUERY_THROW);
OUString propName;
uno::Any aNewValue;
propName = "IncludeFont";
bool aIncludeFont = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont", aIncludeFont);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", !aIncludeFont);
propName = "IncludeJustify";
bool aIncludeJustify = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify", aIncludeJustify);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", !aIncludeJustify);
propName = "IncludeBorder";
bool aIncludeBorder = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder", aIncludeBorder);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", !aIncludeBorder);
propName = "IncludeBackground";
bool aIncludeBackground = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground", aIncludeBackground);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", !aIncludeBackground);
propName = "IncludeNumberFormat";
bool aIncludeNumberFormat = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat",
aIncludeNumberFormat);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat",
!aIncludeNumberFormat);
propName = "IncludeWidthAndHeight";
bool aIncludeWidthAndHeight = false;
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeWidthAndHeight",
aIncludeWidthAndHeight);
aNewValue <<= false;
xTableAutoFormat->setPropertyValue(propName, aNewValue);
CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeWidthAndHeight",
!aIncludeWidthAndHeight);
}
}
/* 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