tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sw / qa / api / SwXTextFieldMasters.cxx
blob50d88404af62ef6f688de49588797b7661e13c44
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/xelementaccess.hxx>
14 #include <com/sun/star/frame/Desktop.hpp>
16 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
18 #include <com/sun/star/text/XTextDocument.hpp>
19 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
20 #include <com/sun/star/beans/XPropertySet.hpp>
21 // #include <com/sun/star/container/XNameAccess.hpp>
23 #include <comphelper/processfactory.hxx>
25 using namespace css;
26 using namespace css::uno;
28 namespace
30 /**
31 * Initial tests for SwXTextFieldMasters.
33 class SwXTextFieldMasters final : public UnoApiTest,
34 public apitest::XElementAccess,
35 public apitest::XNameAccess
37 public:
38 SwXTextFieldMasters()
39 : UnoApiTest(u""_ustr)
40 , XElementAccess(cppu::UnoType<beans::XPropertySet>::get())
41 , XNameAccess(u"com.sun.star.text.fieldmaster.SetExpression.Illustration"_ustr)
45 Reference<XInterface> init() override
47 loadFromURL(u"private:factory/swriter"_ustr);
48 Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
50 Reference<text::XTextFieldsSupplier> xTFS;
52 try
54 xTFS = Reference<text::XTextFieldsSupplier>(xTextDocument, UNO_QUERY_THROW);
56 catch (Exception&)
60 // Reference<container::XNameAccess> xNA = xTFS->getTextFieldMasters();
61 // Sequence<OUString> aNames = xNA->getElementNames();
62 // std::cout << aNames[0] << std::endl;
64 return Reference<XInterface>(xTFS->getTextFieldMasters(), UNO_QUERY_THROW);
67 CPPUNIT_TEST_SUITE(SwXTextFieldMasters);
68 CPPUNIT_TEST(testGetByName);
69 CPPUNIT_TEST(testGetElementNames);
70 CPPUNIT_TEST(testHasByName);
71 CPPUNIT_TEST(testGetElementType);
72 CPPUNIT_TEST(testHasElements);
73 CPPUNIT_TEST_SUITE_END();
76 CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldMasters);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */