diff options
-rw-r--r-- | include/test/text/textcontent.hxx | 51 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv | 3 | ||||
-rw-r--r-- | sc/qa/extras/sceditfieldobj-cell.cxx | 12 | ||||
-rw-r--r-- | sc/qa/extras/sceditfieldobj-header.cxx | 14 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/text/textcontent.cxx | 68 |
6 files changed, 143 insertions, 6 deletions
diff --git a/include/test/text/textcontent.hxx b/include/test/text/textcontent.hxx new file mode 100644 index 000000000000..e6333d60e478 --- /dev/null +++ b/include/test/text/textcontent.hxx @@ -0,0 +1,51 @@ +/* -*- 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/. + */ + +#pragma once + +#include <test/testdllapi.hxx> + +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST TextContent +{ +public: + TextContent(const css::text::TextContentAnchorType aExpectedTCAT, + const css::text::TextContentAnchorType aNewTCAT, + const css::text::WrapTextMode aExpectedWTM, const css::text::WrapTextMode aNewWTM) + : m_aExpectedTCAT(aExpectedTCAT) + , m_aNewTCAT(aNewTCAT) + , m_aExpectedWTM(aExpectedWTM) + , m_aNewWTM(aNewWTM) + { + } + + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + + void testTextContentProperties(); + +protected: + ~TextContent() {} + +private: + css::text::TextContentAnchorType const m_aExpectedTCAT; + css::text::TextContentAnchorType const m_aNewTCAT; + css::text::WrapTextMode const m_aExpectedWTM; + css::text::WrapTextMode const m_aNewWTM; +}; + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv index 1912ae235b3b..35be57d9423c 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellFieldObj.csv @@ -1,6 +1,3 @@ "ScCellFieldObj";"com::sun::star::lang::XComponent";"dispose()" "ScCellFieldObj";"com::sun::star::lang::XComponent";"addEventListener()" "ScCellFieldObj";"com::sun::star::lang::XComponent";"removeEventListener()" -"ScCellFieldObj";"com::sun::star::text::TextContent";"AnchorType#optional" -"ScCellFieldObj";"com::sun::star::text::TextContent";"AnchorTypes#optional" -"ScCellFieldObj";"com::sun::star::text::TextContent";"TextWrap#optional" diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx index 071be82489ff..4852fcc1ca41 100644 --- a/sc/qa/extras/sceditfieldobj-cell.cxx +++ b/sc/qa/extras/sceditfieldobj-cell.cxx @@ -9,15 +9,18 @@ #include <test/calc_unoapi_test.hxx> #include <test/beans/xpropertyset.hxx> +#include <test/text/textcontent.hxx> #include <test/text/xtextfield.hxx> #include <test/text/xtextcontent.hxx> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XTextCursor.hpp> @@ -33,6 +36,7 @@ using namespace css; namespace sc_apitest { class ScEditFieldObj_Cell : public CalcUnoApiTest, + public apitest::TextContent, public apitest::XPropertySet, public apitest::XTextContent, public apitest::XTextField @@ -51,6 +55,9 @@ public: CPPUNIT_TEST_SUITE(ScEditFieldObj_Cell); + // TextContent + CPPUNIT_TEST(testTextContentProperties); + // XPropertySet CPPUNIT_TEST(testGetPropertySetInfo); CPPUNIT_TEST(testGetPropertyValue); @@ -79,6 +86,9 @@ uno::Reference<text::XTextField> ScEditFieldObj_Cell::mxField; ScEditFieldObj_Cell::ScEditFieldObj_Cell() : CalcUnoApiTest("/sc/qa/extras/testdocuments") + , TextContent(text::TextContentAnchorType_AS_CHARACTER, + text::TextContentAnchorType_AS_CHARACTER, text::WrapTextMode_NONE, + text::WrapTextMode_NONE) { } diff --git a/sc/qa/extras/sceditfieldobj-header.cxx b/sc/qa/extras/sceditfieldobj-header.cxx index e04f5087f17f..a38b3a122ebb 100644 --- a/sc/qa/extras/sceditfieldobj-header.cxx +++ b/sc/qa/extras/sceditfieldobj-header.cxx @@ -9,6 +9,7 @@ #include <test/calc_unoapi_test.hxx> #include <test/beans/xpropertyset.hxx> +#include <test/text/textcontent.hxx> #include <test/text/xtextcontent.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -18,6 +19,8 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XTextCursor.hpp> @@ -33,8 +36,9 @@ using namespace css; namespace sc_apitest { class ScEditFieldObj_Header : public CalcUnoApiTest, - public apitest::XTextContent, - public apitest::XPropertySet + public apitest::TextContent, + public apitest::XPropertySet, + public apitest::XTextContent { public: ScEditFieldObj_Header(); @@ -48,6 +52,9 @@ public: CPPUNIT_TEST_SUITE(ScEditFieldObj_Header); + // TextContent + CPPUNIT_TEST(testTextContentProperties); + // XPropertySet CPPUNIT_TEST(testGetPropertySetInfo); CPPUNIT_TEST(testGetPropertyValue); @@ -72,6 +79,9 @@ uno::Reference<text::XText> ScEditFieldObj_Header::mxRightText; ScEditFieldObj_Header::ScEditFieldObj_Header() : CalcUnoApiTest("/sc/qa/extras/testdocuments") + , TextContent(text::TextContentAnchorType_AS_CHARACTER, + text::TextContentAnchorType_AS_CHARACTER, text::WrapTextMode_NONE, + text::WrapTextMode_NONE) { } diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index 5eb13679660a..e400f66ecb62 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -173,6 +173,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/table/xtablecolumns \ test/source/table/xtablerows \ test/source/text/baseindex \ + test/source/text/textcontent \ test/source/text/xsimpletext \ test/source/text/xtext \ test/source/text/xtextcontent \ diff --git a/test/source/text/textcontent.cxx b/test/source/text/textcontent.cxx new file mode 100644 index 000000000000..714011117ca0 --- /dev/null +++ b/test/source/text/textcontent.cxx @@ -0,0 +1,68 @@ +/* -*- 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/text/textcontent.hxx> + +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/beans/XPropertySet.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 css; + +namespace apitest +{ +void TextContent::testTextContentProperties() +{ + uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW); + + text::TextContentAnchorType aExpectedTCAT; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aExpectedTCAT); + CPPUNIT_ASSERT_EQUAL(m_aExpectedTCAT, aExpectedTCAT); + + try + { + xPS->setPropertyValue("AnchorType", uno::makeAny(m_aNewTCAT)); + text::TextContentAnchorType aNewTCAT; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aNewTCAT); + CPPUNIT_ASSERT_EQUAL(m_aNewTCAT, aNewTCAT); + } + catch (const beans::UnknownPropertyException& /* ex */) + { + // ignore if property is optional + } + + uno::Sequence<text::TextContentAnchorType> aAnchorTypes; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorTypes") >>= aAnchorTypes); + CPPUNIT_ASSERT(aAnchorTypes.getLength()); + + text::WrapTextMode aExpectedWTM; + CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aExpectedWTM); + CPPUNIT_ASSERT_EQUAL(m_aExpectedWTM, aExpectedWTM); + + try + { + xPS->setPropertyValue("TextWrap", uno::makeAny(m_aNewWTM)); + text::WrapTextMode aNewWTM; + CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aNewWTM); + CPPUNIT_ASSERT_EQUAL(m_aNewWTM, aNewWTM); + } + catch (const beans::UnknownPropertyException& /* ex */) + { + // ignore if property is optional + } +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |