diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-11-23 15:02:35 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-23 15:04:17 +0100 |
commit | 07b3ea269929148b3289582c9d1e6ac271e3bcc1 (patch) | |
tree | d560a900354b1a0de60bddab5779bbd2d2121dcf /sw | |
parent | 9f412fa751df401a1e0d1da842eefb390b7e5ff7 (diff) |
Carry fix over to CppunitTest_sw_dialogs_test_2
...from 2ec76e5db5c194e133b6fee5c7f81c04357971f8 "Make sure swui's pSwResMgr is
initialized in CppunitTest_sw_dialogs_test", across ignorant
f888d17127557a8fd3867896dcfa1abbb9f6a53d "split sw screenshots test"
Change-Id: I096e22433317186e1a78855532f2c67bd842f366
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_dialogs_test_2.mk | 1 | ||||
-rw-r--r-- | sw/qa/unit/sw-dialogs-test_2.cxx | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_dialogs_test_2.mk b/sw/CppunitTest_sw_dialogs_test_2.mk index 7e6fb0b031e2..12d34c4e060f 100644 --- a/sw/CppunitTest_sw_dialogs_test_2.mk +++ b/sw/CppunitTest_sw_dialogs_test_2.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,sw_dialogs_test2)) $(eval $(call gb_CppunitTest_set_include,sw_dialogs_test2,\ -I$(SRCDIR)/sw/source/ui/inc \ -I$(SRCDIR)/sw/inc \ + -I$(SRCDIR)/sw/source/uibase/inc \ $$(INCLUDE) \ )) diff --git a/sw/qa/unit/sw-dialogs-test_2.cxx b/sw/qa/unit/sw-dialogs-test_2.cxx index cf7758926e8c..5917506aa173 100644 --- a/sw/qa/unit/sw-dialogs-test_2.cxx +++ b/sw/qa/unit/sw-dialogs-test_2.cxx @@ -9,17 +9,25 @@ #include <sal/config.h> #include <test/screenshot_test.hxx> +#include <rtl/bootstrap.hxx> #include <rtl/strbuf.hxx> #include <osl/file.hxx> #include <sfx2/app.hxx> #include <vcl/abstdlg.hxx> +#include <swabstdlg.hxx> + using namespace ::com::sun::star; +extern "C" { using Fn = SwAbstractDialogFactory * (*)(); } + // sw/source/ui/dialog/swuiexp.cxx + /// Test opening a dialog in sw class SwDialogsTest2 : public ScreenshotTest { private: + osl::Module libSwui_; + /// helper method to populate KnownDialogs, called in setUp(). Needs to be /// written and has to add entries to KnownDialogs virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override; @@ -32,6 +40,8 @@ public: SwDialogsTest2(); virtual ~SwDialogsTest2() override; + void setUp() override; + // try to open a dialog void openAnyDialog(); @@ -48,6 +58,22 @@ SwDialogsTest2::~SwDialogsTest2() { } +void SwDialogsTest2::setUp() +{ + ScreenshotTest::setUp(); + // Make sure the swui library's global pSwResMgr is initialized + // (alternatively to dynamically loading the library, SwCreateDialogFactory + // could be declared in an include file and this CppunitTest link against + // the swui library): + OUString url("${LO_LIB_DIR}/" SVLIBRARY("swui")); + rtl::Bootstrap::expandMacros(url); //TODO: detect failure + CPPUNIT_ASSERT(libSwui_.load(url, SAL_LOADMODULE_GLOBAL)); + auto fn = reinterpret_cast<Fn>( + libSwui_.getFunctionSymbol("SwCreateDialogFactory")); + CPPUNIT_ASSERT(fn != nullptr); + (*fn)(); +} + void SwDialogsTest2::registerKnownDialogsByID(mapType& /*rKnownDialogs*/) { // fill map of known dialogs |