/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace css; using namespace css::uno; namespace { /** * Initial tests for SwXFootnote. */ class SwXFootnote final : public UnoApiTest, public apitest::XComponent, public apitest::XSimpleText, public apitest::XTextRange, public apitest::XTextContent, public apitest::XText, public apitest::XFootnote, public apitest::Footnote { public: SwXFootnote(); Reference init() override; Reference getTextRange() override; Reference getTextContent() override; bool isAttachSupported() override { return true; } void triggerDesktopTerminate() override {} CPPUNIT_TEST_SUITE(SwXFootnote); CPPUNIT_TEST(testDispose); CPPUNIT_TEST(testAddEventListener); CPPUNIT_TEST(testRemoveEventListener); CPPUNIT_TEST(testAttach); CPPUNIT_TEST(testGetAnchor); CPPUNIT_TEST(testCreateTextCursor); CPPUNIT_TEST(testCreateTextCursorByRange); CPPUNIT_TEST(testInsertString); CPPUNIT_TEST(testInsertControlCharacter); CPPUNIT_TEST(testGetEnd); CPPUNIT_TEST(testGetSetString); CPPUNIT_TEST(testGetStart); CPPUNIT_TEST(testGetText); CPPUNIT_TEST(testFootnoteProperties); // CPPUNIT_TEST(testInsertRemoveTextContent); CPPUNIT_TEST(testGetSetLabel); CPPUNIT_TEST_SUITE_END(); private: Reference mxTextRange; Reference mxTextContent; }; SwXFootnote::SwXFootnote() : UnoApiTest(u""_ustr) { } Reference SwXFootnote::init() { loadFromURL(u"private:factory/swriter"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xFootnote(xMSF->createInstance(u"com.sun.star.text.Footnote"_ustr), UNO_QUERY_THROW); Reference xText = xTextDocument->getText(); Reference xCursor = xText->createTextCursor(); xText->insertTextContent(xCursor, xFootnote, false); mxTextRange = Reference(xCursor, UNO_QUERY_THROW); mxTextContent = Reference( xMSF->createInstance(u"com.sun.star.text.Footnote"_ustr), UNO_QUERY_THROW); return Reference(xFootnote, UNO_QUERY_THROW); } Reference SwXFootnote::getTextRange() { return mxTextRange; } Reference SwXFootnote::getTextContent() { return mxTextContent; } CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnote); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */