bump product version to 7.2.5.1
[LibreOffice.git] / test / source / text / textcontent.cxx
blob132981b2ac655d27f723b1de032d1fa27b9a02ae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/text/textcontent.hxx>
12 #include <com/sun/star/text/TextContentAnchorType.hpp>
13 #include <com/sun/star/beans/XPropertySet.hpp>
15 #include <com/sun/star/uno/Any.hxx>
16 #include <com/sun/star/uno/Reference.hxx>
17 #include <com/sun/star/uno/Sequence.hxx>
19 #include <cppunit/TestAssert.h>
21 using namespace css;
23 namespace apitest
25 void TextContent::testTextContentProperties()
27 uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW);
29 text::TextContentAnchorType aExpectedTCAT;
30 CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aExpectedTCAT);
31 CPPUNIT_ASSERT_EQUAL(m_aExpectedTCAT, aExpectedTCAT);
33 try
35 xPS->setPropertyValue("AnchorType", uno::makeAny(m_aNewTCAT));
36 text::TextContentAnchorType aNewTCAT;
37 CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aNewTCAT);
38 CPPUNIT_ASSERT_EQUAL(m_aNewTCAT, aNewTCAT);
40 catch (const beans::UnknownPropertyException& /* ex */)
42 // ignore if property is optional
45 uno::Sequence<text::TextContentAnchorType> aAnchorTypes;
46 CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorTypes") >>= aAnchorTypes);
47 CPPUNIT_ASSERT(aAnchorTypes.hasElements());
49 text::WrapTextMode aExpectedWTM;
50 CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aExpectedWTM);
51 CPPUNIT_ASSERT_EQUAL(m_aExpectedWTM, aExpectedWTM);
53 try
55 xPS->setPropertyValue("TextWrap", uno::makeAny(m_aNewWTM));
56 text::WrapTextMode aNewWTM;
57 CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aNewWTM);
58 CPPUNIT_ASSERT_EQUAL(m_aNewWTM, aNewWTM);
60 catch (const beans::UnknownPropertyException& /* ex */)
62 // ignore if property is optional
66 } // namespace apitest
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */