diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-08-29 17:54:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-08-29 17:54:04 +0200 |
commit | 471408327978144dcc11f5f65f8208016867e03a (patch) | |
tree | e16998ccbf5786b70198c9cd040b08aa60eac471 /test/source/vclbootstrapprotector.cxx | |
parent | CairoFontsCache is only used in cairotextrender.cxx (diff) | |
download | core-471408327978144dcc11f5f65f8208016867e03a.tar.gz core-471408327978144dcc11f5f65f8208016867e03a.zip |
Remove duplication of "set up VCL" code
The "this is called from pyuno" version in test/source/bootstrapfixture.cxx had
had an empty deinitHook, but it appears to not hurt to give it the same
deinitHook as the version in test/source/vclbootstrapprotector.cxx had had.
Make test::setUpVcl accessible from outside module test for an upcoming use in
<https://gerrit.libreoffice.org/#/c/28322/16> "tdf#99402: fix Metafile Font
handling".
Change-Id: I1d609445690b6ee5e331aa322cd4bf434a3de78e
Diffstat (limited to 'test/source/vclbootstrapprotector.cxx')
-rw-r--r-- | test/source/vclbootstrapprotector.cxx | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/test/source/vclbootstrapprotector.cxx b/test/source/vclbootstrapprotector.cxx index 2f193c6bd04a..fb8531d71481 100644 --- a/test/source/vclbootstrapprotector.cxx +++ b/test/source/vclbootstrapprotector.cxx @@ -9,19 +9,10 @@ #include <sal/config.h> -#include <com/sun/star/configuration/theDefaultProvider.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/util/XFlushable.hpp> -#include <comphelper/processfactory.hxx> #include <cppunit/Protector.h> #include <cppunittester/protectorfactory.hxx> -#include <i18nlangtag/lang.h> -#include <i18nlangtag/languagetag.hxx> -#include <i18nlangtag/mslangid.hxx> #include <sal/types.h> -#include <tools/resmgr.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/syslocaleoptions.hxx> +#include <test/setupvcl.hxx> #include <vcl/svapp.hxx> #include <isheadless.hxx> @@ -30,20 +21,7 @@ namespace { class Protector: public CppUnit::Protector { public: - Protector() { - // Force locale (and resource files loaded) to en-US: - ResMgr::SetDefaultLocale(LanguageTag("en-US")); - SvtSysLocaleOptions localOptions; - localOptions.SetLocaleConfigString("en-US"); - localOptions.SetUILocaleConfigString("en-US"); - MsLangId::setConfiguredSystemUILanguage(LANGUAGE_ENGLISH_US); - LanguageTag::setConfiguredSystemLanguage(LANGUAGE_ENGLISH_US); - InitVCL(); - if (test::isHeadless()) { - Application::EnableHeadlessMode(true); - } - Application::setDeInitHook(LINK(this, Protector, deinitHook)); - } + Protector() { test::setUpVcl(); } Protector(const Protector&) = delete; Protector& operator=(const Protector&) = delete; @@ -56,36 +34,8 @@ private: CppUnit::Functor const & functor, CppUnit::ProtectorContext const &) override { return functor(); } - - DECL_STATIC_LINK_TYPED(Protector, deinitHook, LinkParamNone*, void); }; -// HACK so that defaultBootstrap_InitialComponentContext (in -// unobootstrapprotector) is called before InitVCL (above), but component -// context is disposed (redundantly again in unobootstrapprotector) from within -// DeInitVCL (cf. Desktop::DeInit, desktop/source/app/app.cxx): -IMPL_STATIC_LINK_NOARG_TYPED(Protector, deinitHook, LinkParamNone*, void) -{ - css::uno::Reference<css::uno::XComponentContext> context; - try { - context = comphelper::getProcessComponentContext(); - } catch (css::uno::RuntimeException &) {} - if (context.is()) { - css::uno::Reference<css::lang::XMultiServiceFactory> config; - try { - config = css::configuration::theDefaultProvider::get(context); - } catch (css::uno::DeploymentException &) {} - if (config.is()) { - utl::ConfigManager::storeConfigItems(); - css::uno::Reference<css::util::XFlushable>( - config, css::uno::UNO_QUERY_THROW)->flush(); - } - css::uno::Reference<css::lang::XComponent>( - context, css::uno::UNO_QUERY_THROW)->dispose(); - comphelper::setProcessServiceFactory(nullptr); - } -} - } extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector * SAL_CALL |