LibreOffice Module test (master) 1
vclbootstrapprotector.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include <sal/config.h>
11
12#include <cppunit/Protector.h>
13#include <sal/types.h>
14#include <sal/log.hxx>
15#include <vcl/svapp.hxx>
17#include "setupvcl.hxx"
18
19namespace {
20
21class Protector: public CppUnit::Protector {
22public:
23 Protector() { test::setUpVcl(); }
24 Protector(const Protector&) = delete;
25 Protector& operator=(const Protector&) = delete;
26
27private:
28 virtual ~Protector() override {
29#if defined(__COVERITY__)
30 try {
31#endif
32 DeInitVCL();
33 // for the 6 tests that use it
35#if defined(__COVERITY__)
36 } catch (const std::exception& e) {
37 SAL_WARN("vcl.app", "Fatal exception: " << e.what());
38 std::terminate();
39 }
40#endif
41 }
42
43 virtual bool protect(
44 CppUnit::Functor const & functor, CppUnit::ProtectorContext const &)
45 override
46 { return functor(); }
47};
48
49}
50
51extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector *
53 return new Protector;
54}
55
56/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static ThreadPool & getSharedOptimalPool()
#define SAL_WARN(area, stream)
OOO_DLLPUBLIC_TEST_SETUPVCL void setUpVcl(bool forceHeadless=false)
Definition: setupvcl.cxx:73
VCL_DLLPUBLIC void DeInitVCL()
SAL_DLLPUBLIC_EXPORT CppUnit::Protector * vclbootstrapprotector()