use insert function instead of for loop
[LibreOffice.git] / sw / qa / api / SwXAutoTextContainer.cxx
blob4d6031a990e4d143b56aa4e711813c0441f2b58b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/unoapi_test.hxx>
11 #include <test/container/xnameaccess.hxx>
12 #include <test/container/xindexaccess.hxx>
13 #include <test/container/xelementaccess.hxx>
14 #include <test/text/xautotextcontainer.hxx>
16 #include <com/sun/star/frame/Desktop.hpp>
18 #include <com/sun/star/text/XAutoTextContainer.hpp>
19 #include <com/sun/star/text/AutoTextContainer.hpp>
21 #include <comphelper/processfactory.hxx>
23 using namespace css;
24 using namespace css::uno;
26 namespace
28 /**
29 * Initial tests for SwXAutoTextContainer.
31 class SwXAutoTextContainer final : public UnoApiTest,
32 public apitest::XElementAccess,
33 public apitest::XIndexAccess,
34 public apitest::XNameAccess
36 public:
37 SwXAutoTextContainer()
38 : UnoApiTest(u""_ustr)
39 , XElementAccess(cppu::UnoType<text::XAutoTextGroup>::get())
40 , XIndexAccess(3)
41 , XNameAccess(u"crdbus50"_ustr)
45 virtual void setUp() override
47 UnoApiTest::setUp();
48 mxDesktop.set(frame::Desktop::create(m_xContext));
51 Reference<XInterface> init() override
53 Reference<text::XAutoTextContainer> xAutoTextContainer
54 = text::AutoTextContainer::create(comphelper::getProcessComponentContext());
56 Reference<container::XNameAccess> xNA(xAutoTextContainer, UNO_QUERY_THROW);
57 Sequence<rtl::OUString> aNames = xNA->getElementNames();
58 std::cout << aNames[0] << std::endl;
60 return Reference<XInterface>(xAutoTextContainer, UNO_QUERY_THROW);
63 CPPUNIT_TEST_SUITE(SwXAutoTextContainer);
64 CPPUNIT_TEST(testGetByName);
65 CPPUNIT_TEST(testGetElementNames);
66 CPPUNIT_TEST(testHasByName);
67 CPPUNIT_TEST(testGetCount);
68 CPPUNIT_TEST(testGetByIndex);
69 CPPUNIT_TEST(testGetElementType);
70 CPPUNIT_TEST(testHasElements);
71 CPPUNIT_TEST_SUITE_END();
74 CPPUNIT_TEST_SUITE_REGISTRATION(SwXAutoTextContainer);
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */