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 <sal/config.h>
11 #include <test/screenshot_test.hxx>
12 #include <rtl/bootstrap.hxx>
13 #include <tools/svlibrary.h>
14 #include <vcl/abstdlg.hxx>
15 #include <comphelper/processfactory.hxx>
16 #include <com/sun/star/text/DialogFactoryService.hpp>
19 class SwAbstractDialogFactory
;
21 using namespace ::com::sun::star
;
23 extern "C" { using Fn
= SwAbstractDialogFactory
* (*)(); }
24 // sw/source/ui/dialog/swuiexp.cxx
26 /// Test opening a dialog in sw
27 class SwDialogsTest2
: public ScreenshotTest
30 /// helper method to populate KnownDialogs, called in setUp(). Needs to be
31 /// written and has to add entries to KnownDialogs
32 virtual void registerKnownDialogsByID(mapType
& rKnownDialogs
) override
;
34 /// dialog creation for known dialogs by ID. Has to be implemented for
35 /// each registered known dialog
36 virtual VclPtr
<VclAbstractDialog
> createDialogByID(sal_uInt32 nID
) override
;
41 void setUp() override
;
43 // try to open a dialog
46 CPPUNIT_TEST_SUITE(SwDialogsTest2
);
47 CPPUNIT_TEST(openAnyDialog
);
48 CPPUNIT_TEST_SUITE_END();
51 SwDialogsTest2::SwDialogsTest2()
55 void SwDialogsTest2::setUp()
57 ScreenshotTest::setUp();
59 // Make sure the swui library's global pSwResMgr is initialized
60 auto xService
= css::text::DialogFactoryService::create(comphelper::getProcessComponentContext());
61 CPPUNIT_ASSERT(xService
.is());
62 // get a factory instance
63 SwAbstractDialogFactory
* pFactory
= reinterpret_cast<SwAbstractDialogFactory
*>(xService
->getSomething({}));
64 CPPUNIT_ASSERT(pFactory
!= nullptr);
67 void SwDialogsTest2::registerKnownDialogsByID(mapType
& /*rKnownDialogs*/)
69 // fill map of known dialogs
72 VclPtr
<VclAbstractDialog
> SwDialogsTest2::createDialogByID(sal_uInt32
/*nID*/)
77 void SwDialogsTest2::openAnyDialog()
79 /// process input file containing the UXMLDescriptions of the dialogs to dump
80 processDialogBatchFile(u
"sw/qa/unit/data/sw-dialogs-test_2.txt");
83 CPPUNIT_TEST_SUITE_REGISTRATION(SwDialogsTest2
);
85 CPPUNIT_PLUGIN_IMPLEMENT();
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */