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/unoapi_test.hxx>
11 #include <test/container/xelementaccess.hxx>
12 #include <test/container/xindexaccess.hxx>
13 #include <test/container/xnameaccess.hxx>
15 #include <com/sun/star/frame/Desktop.hpp>
17 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
19 #include <com/sun/star/text/XTextDocument.hpp>
20 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
21 #include <com/sun/star/container/XIndexAccess.hpp>
22 #include <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/container/XNameContainer.hpp>
26 using namespace css::uno
;
31 * Initial tests for SwXStyleFamilies.
33 class SwXStyleFamilies final
: public UnoApiTest
,
34 public apitest::XElementAccess
,
35 public apitest::XIndexAccess
,
36 public apitest::XNameAccess
41 : UnoApiTest(u
""_ustr
)
42 , XElementAccess(cppu::UnoType
<container::XNameContainer
>::get())
44 , XNameAccess(u
"CharacterStyles"_ustr
)
48 Reference
<XInterface
> init() override
50 loadFromURL(u
"private:factory/swriter"_ustr
);
51 Reference
<text::XTextDocument
> xTextDocument(mxComponent
, UNO_QUERY_THROW
);
52 Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, UNO_QUERY_THROW
);
54 Reference
<style::XStyleFamiliesSupplier
> xStyleFamSupp(xTextDocument
, UNO_QUERY_THROW
);
55 Reference
<container::XNameAccess
> xSF
= xStyleFamSupp
->getStyleFamilies();
57 return Reference
<XInterface
>(xSF
, UNO_QUERY_THROW
);
60 CPPUNIT_TEST_SUITE(SwXStyleFamilies
);
61 CPPUNIT_TEST(testGetElementType
);
62 CPPUNIT_TEST(testHasElements
);
63 CPPUNIT_TEST(testGetCount
);
64 CPPUNIT_TEST(testGetByIndex
);
65 CPPUNIT_TEST(testGetByName
);
66 CPPUNIT_TEST(testGetElementNames
);
67 CPPUNIT_TEST(testHasByName
);
68 CPPUNIT_TEST_SUITE_END();
71 CPPUNIT_TEST_SUITE_REGISTRATION(SwXStyleFamilies
);
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */