1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/xtextrange.hxx>
12 #include <com/sun/star/text/XText.hpp>
13 #include <com/sun/star/text/XTextRange.hpp>
15 #include <cppunit/TestAssert.h>
21 void XTextRange::testGetEnd()
23 uno::Reference
<text::XTextRange
> xTextRange(init(), uno::UNO_QUERY_THROW
);
25 xTextRange
->setString("UnitTest");
26 uno::Reference
<text::XTextRange
> xTR_end(xTextRange
->getEnd(), uno::UNO_SET_THROW
);
27 xTR_end
->setString("End");
29 CPPUNIT_ASSERT(xTextRange
->getText()->getString().endsWith("End"));
32 void XTextRange::testGetSetString()
34 uno::Reference
<text::XTextRange
> xTextRange(init(), uno::UNO_QUERY_THROW
);
36 xTextRange
->setString("UnitTest");
37 CPPUNIT_ASSERT_EQUAL(OUString("UnitTest"), xTextRange
->getString());
40 void XTextRange::testGetStart()
42 uno::Reference
<text::XTextRange
> xTextRange(init(), uno::UNO_QUERY_THROW
);
44 xTextRange
->setString("UnitTest");
45 uno::Reference
<text::XTextRange
> xTR_start(xTextRange
->getStart(), uno::UNO_SET_THROW
);
46 xTR_start
->setString("Start");
48 CPPUNIT_ASSERT(xTextRange
->getText()->getString().startsWith("Start"));
51 void XTextRange::testGetText()
53 uno::Reference
<text::XTextRange
> xTextRange(init(), uno::UNO_QUERY_THROW
);
55 xTextRange
->setString("UnitTest");
56 uno::Reference
<text::XText
> xText(xTextRange
->getText(), uno::UNO_SET_THROW
);
57 CPPUNIT_ASSERT_EQUAL(OUString("UnitTest"), xTextRange
->getString());
59 } // namespace apitest
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */