tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sw / qa / api / SwXTextFieldTypes.cxx
blobeaf44ca2df67d2b7ad24de0903bba815398a6b4f
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/xelementaccess.hxx>
12 #include <test/container/xenumerationaccess.hxx>
13 #include <test/util/xrefreshable.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/text/XTextFieldsSupplier.hpp>
21 #include <com/sun/star/text/XDependentTextField.hpp>
23 #include <comphelper/processfactory.hxx>
25 using namespace css;
26 using namespace css::uno;
28 namespace
30 /**
31 * Initial tests for SwXTextFieldTypes.
33 class SwXTextFieldTypes final : public UnoApiTest,
34 public apitest::XElementAccess,
35 public apitest::XEnumerationAccess,
36 public apitest::XRefreshable
38 public:
39 SwXTextFieldTypes()
40 : UnoApiTest(u""_ustr)
41 , XElementAccess(cppu::UnoType<text::XDependentTextField>::get())
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 return Reference<XInterface>(xTFS->getTextFields(), UNO_QUERY_THROW);
63 CPPUNIT_TEST_SUITE(SwXTextFieldTypes);
64 CPPUNIT_TEST(testGetElementType);
65 CPPUNIT_TEST(testHasElements);
66 CPPUNIT_TEST(testCreateEnumeration);
67 CPPUNIT_TEST(testRefreshListener);
68 CPPUNIT_TEST_SUITE_END();
71 CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldTypes);
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */