diff options
author | Jens Carl <j.carl43@gmx.de> | 2019-04-11 22:24:00 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2019-04-12 06:12:19 +0200 |
commit | c498e548ee45430b31cb63df17818ba39771ef7c (patch) | |
tree | a15a7c94f5edff26eabaef900b1012a7ce6e5e8e /test | |
parent | 74288f5af28de3d14044c951e7e5d62bb2e22301 (diff) |
tdf#45904 Move TextContent Java tests to C++
Move TextContent Java tests to C++ for ScEditFieldObj_Cell and
ScEditFieldObj_Header (formerly ScCellFieldObj).
Change-Id: Ieed5cdbc128490e66d1797c817d998a932317dd4
Reviewed-on: https://gerrit.libreoffice.org/70615
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/text/textcontent.cxx | 68 |
2 files changed, 69 insertions, 0 deletions
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: */ |