diff options
-rw-r--r-- | framework/qa/complex/api_internal/api.lst | 1 | ||||
-rw-r--r-- | include/test/sheet/xheaderfootercontent.hxx | 36 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 2 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFooterContentObj.csv | 3 | ||||
-rw-r--r-- | qadevOOo/tests/java/ifc/sheet/_XHeaderFooterContent.java | 73 | ||||
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java | 135 | ||||
-rw-r--r-- | sc/CppunitTest_sc_headerfootercontentobj.mk | 105 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/scheaderfootercontentobj.cxx | 120 | ||||
-rw-r--r-- | sc/qa/unoapi/sc_4.sce | 1 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/xheaderfootercontent.cxx | 49 |
12 files changed, 312 insertions, 215 deletions
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst index fe472e824ea5..dae7278c29b0 100644 --- a/framework/qa/complex/api_internal/api.lst +++ b/framework/qa/complex/api_internal/api.lst @@ -96,7 +96,6 @@ job96=sc.ScFilterDescriptorBase job97=sc.ScFunctionListObj job98=sc.ScHeaderFieldObj job99=sc.ScHeaderFieldsObj -job100=sc.ScHeaderFooterContentObj job101=sc.ScIndexEnumeration_CellAnnotationsEnumeration job102=sc.ScIndexEnumeration_CellAreaLinksEnumeration job103=sc.ScIndexEnumeration_DatabaseRangesEnumeration diff --git a/include/test/sheet/xheaderfootercontent.hxx b/include/test/sheet/xheaderfootercontent.hxx new file mode 100644 index 000000000000..64d3fea46341 --- /dev/null +++ b/include/test/sheet/xheaderfootercontent.hxx @@ -0,0 +1,36 @@ +/* -*- 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_XHEADERFOOTERCONTENT_HXX +#define INCLUDED_TEST_SHEET_XHEADERFOOTERCONTENT_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 XHeaderFooterContent +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + + void testGetCenterText(); + void testGetLeftText(); + void testGetRightText(); + +protected: + ~XHeaderFooterContent() {} +}; +} + +#endif // INCLUDED_TEST_SHEET_XHEADERFOOTERCONTENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 0064c67a5dcf..ca7efb955432 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/_XEnhancedMouseClickBroadcaster \ qadevOOo/tests/java/ifc/sheet/_XFormulaQuery \ qadevOOo/tests/java/ifc/sheet/_XFunctionDescriptions \ - qadevOOo/tests/java/ifc/sheet/_XHeaderFooterContent \ qadevOOo/tests/java/ifc/sheet/_XMultipleOperation \ qadevOOo/tests/java/ifc/sheet/_XRangeSelection \ qadevOOo/tests/java/ifc/sheet/_XRecentFunctions \ @@ -1043,7 +1042,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/mod/_sc/ScFunctionListObj \ qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj \ qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj \ - qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj \ qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor \ qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj \ qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFooterContentObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFooterContentObj.csv deleted file mode 100644 index e04311b56418..000000000000 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFooterContentObj.csv +++ /dev/null @@ -1,3 +0,0 @@ -"ScHeaderFooterContentObj";"com::sun::star::sheet::XHeaderFooterContent";"getLeftText()" -"ScHeaderFooterContentObj";"com::sun::star::sheet::XHeaderFooterContent";"getCenterText()" -"ScHeaderFooterContentObj";"com::sun::star::sheet::XHeaderFooterContent";"getRightText()" diff --git a/qadevOOo/tests/java/ifc/sheet/_XHeaderFooterContent.java b/qadevOOo/tests/java/ifc/sheet/_XHeaderFooterContent.java deleted file mode 100644 index b507618b8ec9..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XHeaderFooterContent.java +++ /dev/null @@ -1,73 +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 com.sun.star.sheet.XHeaderFooterContent; -import com.sun.star.text.XText; - -/** - * Testing <code>com.sun.star.sheet.XHeaderFooterContent</code> - * interface methods : - * <ul> - * <li><code> getLeftText()</code></li> - * <li><code> getCenterText()</code></li> - * <li><code> getRightText()</code></li> - * </ul> <p> - * - * @see com.sun.star.sheet.XHeaderFooterContent - */ -public class _XHeaderFooterContent extends MultiMethodTest { - - public XHeaderFooterContent oObj = null; - - /** - * Test calls the method and checks string obtained from returned value. <p> - * Has <b>OK</b> status if obtained string is equal to <code>"LEFT"</code>. - * <p> - */ - public void _getLeftText() { - XText left = oObj.getLeftText(); - tRes.tested("getLeftText()",left.getString().equals("LEFT")); - } - - /** - * Test calls the method and checks string obtained from returned value. <p> - * Has <b>OK</b> status if obtained string is equal to <code>"RIGHT"</code>. - * <p> - */ - public void _getRightText() { - XText right = oObj.getRightText(); - tRes.tested("getRightText()",right.getString().equals("RIGHT")); - } - - /** - * Test calls the method and checks string obtained from returned value. <p> - * Has <b>OK</b> status if obtained string is equal to <code>"CENTER"</code>. - * <p> - */ - public void _getCenterText() { - XText center = oObj.getCenterText(); - tRes.tested("getCenterText()",center.getString().equals("CENTER")); - } - -} // finish class _XHeaderFooterContent - - diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java deleted file mode 100644 index b74046367f52..000000000000 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java +++ /dev/null @@ -1,135 +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 mod._sc; - -import java.io.PrintWriter; - -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import util.SOfficeFactory; - -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XNameAccess; -import com.sun.star.lang.XComponent; -import com.sun.star.sheet.XHeaderFooterContent; -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.style.XStyle; -import com.sun.star.style.XStyleFamiliesSupplier; -import com.sun.star.text.XText; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; - -/** -* Test for object which is represented by service -* <code>com.sun.star.sheet.HeaderFooterContent</code>. <p> -* Object implements the following interfaces : -* <ul> -* <li> <code>com::sun::star::sheet::XHeaderFooterContent</code></li> -* </ul> -* @see com.sun.star.sheet.HeaderFooterContent -* @see com.sun.star.sheet.XHeaderFooterContent -* @see ifc.sheet._XHeaderFooterContent -*/ -public class ScHeaderFooterContentObj extends TestCase { - private XSpreadsheetDocument xSpreadsheetDoc; - - /** - * Creates Spreadsheet document. - */ - @Override - protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); - log.println( "creating a Spreadsheet document" ); - xSpreadsheetDoc = SOF.createCalcDoc(null); - } - - /** - * Disposes Spreadsheet document. - */ - @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xSheetDoc " ); - XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc); - util.DesktopTools.closeDoc(oComp); - } - - /** - * Creating a TestEnvironment for the interfaces to be tested. - * Retrieves the collection of style families available in the document - * using the interface <code>XStyleFamiliesSupplier</code>. - * Obtains default style from the style family <code>'PageStyles'</code>. - * Retrieves value of the property <code>'RightPageHeaderContent'</code>. - * Sets some text for every part of header or footer using the interface - * <code>XHeaderFooterContent</code> and sets new value of the property - * <code>'RightPageHeaderContent'</code>. The value of this property is the - * instance of the service <code>com.sun.star.sheet.HeaderFooterContent</code>. - * @see com.sun.star.style.XStyleFamiliesSupplier - * @see com.sun.star.sheet.XHeaderFooterContent - * @see com.sun.star.sheet.HeaderFooterContent - */ - @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { - - XInterface oObj = null; - XPropertySet PropSet; - XNameAccess PageStyles = null; - XStyle StdStyle = null; - - XStyleFamiliesSupplier StyleFam = UnoRuntime.queryInterface( - XStyleFamiliesSupplier.class, - xSpreadsheetDoc ); - XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - - //get the property-set - PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); - - XHeaderFooterContent RPHC = null; - // creation of testobject here - // first we write what we are intend to do to log file - log.println( "creating a test environment" ); - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - - XText center = RPHC.getCenterText(); - XText left = RPHC.getLeftText(); - XText right = RPHC.getRightText(); - - center.setString("CENTER"); - left.setString("LEFT"); - right.setString("RIGHT"); - - PropSet.setPropertyValue("RightPageHeaderContent", RPHC); - - // create testobject here - oObj = RPHC; - TestEnvironment tEnv = new TestEnvironment(oObj); - - return tEnv; - - } // finish method getTestEnvironment - -} // finish class ScHeaderFooterContentObj diff --git a/sc/CppunitTest_sc_headerfootercontentobj.mk b/sc/CppunitTest_sc_headerfootercontentobj.mk new file mode 100644 index 000000000000..485d1ade3540 --- /dev/null +++ b/sc/CppunitTest_sc_headerfootercontentobj.mk @@ -0,0 +1,105 @@ +# -*- 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_headerfootercontentobj)) + +$(eval $(call gb_CppunitTest_use_external,sc_headerfootercontentobj,boost_headers)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_headerfootercontentobj, \ + sc/qa/extras/scheaderfootercontentobj \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_headerfootercontentobj, \ + 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_headerfootercontentobj,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sc_headerfootercontentobj)) + +$(eval $(call gb_CppunitTest_use_ure,sc_headerfootercontentobj)) +$(eval $(call gb_CppunitTest_use_vcl,sc_headerfootercontentobj)) + +$(eval $(call gb_CppunitTest_use_components,sc_headerfootercontentobj,\ + 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_headerfootercontentobj)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index c098e0de7ff6..55f2dfd19b0b 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -140,6 +140,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ CppunitTest_sc_scenariosobj \ CppunitTest_sc_labelrangesobj \ CppunitTest_sc_labelrangeobj \ + CppunitTest_sc_headerfootercontentobj \ )) $(eval $(call gb_Module_add_perfcheck_targets,sc,\ diff --git a/sc/qa/extras/scheaderfootercontentobj.cxx b/sc/qa/extras/scheaderfootercontentobj.cxx new file mode 100644 index 000000000000..c407d47d154a --- /dev/null +++ b/sc/qa/extras/scheaderfootercontentobj.cxx @@ -0,0 +1,120 @@ +/* -*- 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/xheaderfootercontent.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XInterface.hpp> + +using namespace css; +using namespace css::uno; +using namespace com::sun::star; + +namespace sc_apitest +{ +#define NUMBER_OF_TESTS 3 + +class ScHeaderFooterContentObj : public CalcUnoApiTest, public apitest::XHeaderFooterContent +{ +public: + ScHeaderFooterContentObj(); + + virtual uno::Reference<uno::XInterface> init() override; + virtual void setUp() override; + virtual void tearDown() override; + + CPPUNIT_TEST_SUITE(ScHeaderFooterContentObj); + + // XHeaderFooterContent + CPPUNIT_TEST(testGetCenterText); + CPPUNIT_TEST(testGetLeftText); + CPPUNIT_TEST(testGetRightText); + + CPPUNIT_TEST_SUITE_END(); + +private: + static sal_Int32 nTest; + static uno::Reference<lang::XComponent> mxComponent; +}; + +sal_Int32 ScHeaderFooterContentObj::nTest = 0; +uno::Reference<lang::XComponent> ScHeaderFooterContentObj::mxComponent; + +ScHeaderFooterContentObj::ScHeaderFooterContentObj() + : CalcUnoApiTest("/sc/qa/extras/testdocuments") +{ +} + +uno::Reference<uno::XInterface> ScHeaderFooterContentObj::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<style::XStyleFamiliesSupplier> xStyleFamSupp(xDoc, UNO_QUERY_THROW); + uno::Reference<container::XNameAccess> xStyleFamiliesNames(xStyleFamSupp->getStyleFamilies(), + UNO_QUERY_THROW); + uno::Reference<container::XNameAccess> xPageStyles(xStyleFamiliesNames->getByName("PageStyles"), + UNO_QUERY_THROW); + uno::Any aDefaultStyle = xPageStyles->getByName("Default"); + uno::Reference<beans::XPropertySet> xProp(aDefaultStyle, UNO_QUERY_THROW); + + uno::Any aHFC = xProp->getPropertyValue("RightPageHeaderContent"); + uno::Reference<sheet::XHeaderFooterContent> xHFC(aHFC, UNO_QUERY_THROW); + + uno::Reference<text::XText> xTxtCenter = xHFC->getCenterText(); + uno::Reference<text::XText> xTxtLeft = xHFC->getLeftText(); + uno::Reference<text::XText> xTxtRight = xHFC->getRightText(); + + xTxtCenter->setString("CENTER"); + xTxtLeft->setString("LEFT"); + xTxtRight->setString("RIGHT"); + + xProp->setPropertyValue("RightPageHeaderContent", aHFC); + + return xHFC; +} + +void ScHeaderFooterContentObj::setUp() +{ + nTest++; + CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS); + CalcUnoApiTest::setUp(); +} + +void ScHeaderFooterContentObj::tearDown() +{ + if (nTest == NUMBER_OF_TESTS) + { + closeDocument(mxComponent); + mxComponent.clear(); + } + + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScHeaderFooterContentObj); + +} // end namespace + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/qa/unoapi/sc_4.sce b/sc/qa/unoapi/sc_4.sce index d631ac99878b..870f7e9e1bd2 100644 --- a/sc/qa/unoapi/sc_4.sce +++ b/sc/qa/unoapi/sc_4.sce @@ -29,7 +29,6 @@ # ported to cppunit -o sc.ScHeaderFieldObj -o sc.ScHeaderFieldsObj # The two HeaderFooter tests seem to fail randomly -# -o sc.ScHeaderFooterContentObj # -o sc.ScHeaderFooterTextCursor # SHF_TextObj is composed of SHF_TextData, which has a weak reference to # SHF_ContentObj, which itself has three references to SHF_TextObj. diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index e70ee12970f3..803f18303799 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -60,6 +60,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/xdatapilotfieldgrouping \ test/source/sheet/xdatapilottable \ test/source/sheet/xdatapilottable2 \ + test/source/sheet/xheaderfootercontent \ test/source/sheet/xlabelrange \ test/source/sheet/xlabelranges \ test/source/sheet/xnamedrange \ diff --git a/test/source/sheet/xheaderfootercontent.cxx b/test/source/sheet/xheaderfootercontent.cxx new file mode 100644 index 000000000000..6e03dafe2328 --- /dev/null +++ b/test/source/sheet/xheaderfootercontent.cxx @@ -0,0 +1,49 @@ +/* -*- 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/xheaderfootercontent.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/extensions/HelperMacros.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XHeaderFooterContent::testGetCenterText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getCenterText(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get center text", OUString("CENTER"), + xText->getString()); +} + +void XHeaderFooterContent::testGetLeftText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getLeftText(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get left text", OUString("LEFT"), xText->getString()); +} +void XHeaderFooterContent::testGetRightText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getRightText(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get right text", OUString("RIGHT"), xText->getString()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |