1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include "test/text/xtextcontent.hxx"
11 #include <com/sun/star/text/XTextContent.hpp>
12 #include <com/sun/star/text/XTextRange.hpp>
13 #include <com/sun/star/lang/IllegalArgumentException.hpp>
14 #include "cppunit/extensions/HelperMacros.h"
17 using namespace css::uno
;
21 void XTextContent::testGetAnchor()
23 uno::Reference
< text::XTextContent
> xTextContent(init(), UNO_QUERY_THROW
);
24 uno::Reference
< uno::XInterface
> xAnchor(xTextContent
->getAnchor());
25 CPPUNIT_ASSERT(xAnchor
.is());
28 void XTextContent::testAttach()
30 uno::Reference
< text::XTextContent
> xTextContent(init(), UNO_QUERY_THROW
);
31 uno::Reference
< text::XTextRange
> xAnchor
= xTextContent
->getAnchor();
33 uno::Reference
< text::XTextContent
> xContent(getTextContent(), UNO_QUERY_THROW
);
34 uno::Reference
< text::XTextRange
> xRange(getTextRange(), UNO_QUERY_THROW
);
39 xContent
->attach(xRange
);
41 xTextContent
->attach(xRange
);
43 catch (const lang::IllegalArgumentException
&)
45 bool bAttachSupported
= isAttachSupported();
47 CPPUNIT_ASSERT(false);
49 catch (const RuntimeException
&)
51 bool bAttachSupported
= isAttachSupported();
53 CPPUNIT_ASSERT(false);
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */