2014-06-04 08:57:32 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sal/config.h>
|
|
|
|
|
|
|
|
#include <cppunit/Protector.h>
|
|
|
|
#include <cppunittester/protectorfactory.hxx>
|
|
|
|
#include <sal/types.h>
|
2016-08-29 17:54:04 +02:00
|
|
|
#include <test/setupvcl.hxx>
|
2014-06-04 08:57:32 +02:00
|
|
|
#include <vcl/svapp.hxx>
|
2017-03-18 10:53:47 +01:00
|
|
|
#include <comphelper/threadpool.hxx>
|
2014-06-04 08:57:32 +02:00
|
|
|
|
2014-12-10 16:17:15 +01:00
|
|
|
#include <isheadless.hxx>
|
|
|
|
|
2014-06-04 08:57:32 +02:00
|
|
|
namespace {
|
|
|
|
|
2016-04-13 10:11:37 +02:00
|
|
|
class Protector: public CppUnit::Protector {
|
2014-06-04 08:57:32 +02:00
|
|
|
public:
|
2016-08-29 17:54:04 +02:00
|
|
|
Protector() { test::setUpVcl(); }
|
2016-04-13 10:11:37 +02:00
|
|
|
Protector(const Protector&) = delete;
|
|
|
|
Protector& operator=(const Protector&) = delete;
|
2014-06-04 08:57:32 +02:00
|
|
|
|
|
|
|
private:
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~Protector() override {
|
2014-06-04 08:57:32 +02:00
|
|
|
DeInitVCL();
|
2017-03-18 10:53:47 +01:00
|
|
|
// for the 6 tests that use it
|
|
|
|
comphelper::ThreadPool::getSharedOptimalPool().shutdown();
|
2014-06-04 08:57:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool protect(
|
|
|
|
CppUnit::Functor const & functor, CppUnit::ProtectorContext const &)
|
2015-10-12 16:04:04 +02:00
|
|
|
override
|
2014-06-04 08:57:32 +02:00
|
|
|
{ return functor(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector * SAL_CALL
|
|
|
|
vclbootstrapprotector() {
|
|
|
|
return new Protector;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|