diff options
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 |