bump product version to 6.4.0.3
[LibreOffice.git] / test / source / vclbootstrapprotector.cxx
blob18d9a5fecac22c0054da36f6d8b710ced70151ce
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include <sal/config.h>
12 #include <cppunit/Protector.h>
13 #include <cppunittester/protectorfactory.hxx>
14 #include <sal/types.h>
15 #include <sal/log.hxx>
16 #include <test/setupvcl.hxx>
17 #include <vcl/svapp.hxx>
18 #include <comphelper/threadpool.hxx>
20 #include "isheadless.hxx"
22 namespace {
24 class Protector: public CppUnit::Protector {
25 public:
26 Protector() { test::setUpVcl(); }
27 Protector(const Protector&) = delete;
28 Protector& operator=(const Protector&) = delete;
30 private:
31 virtual ~Protector() override {
32 #if defined(__COVERITY__)
33 try {
34 #endif
35 DeInitVCL();
36 // for the 6 tests that use it
37 comphelper::ThreadPool::getSharedOptimalPool().shutdown();
38 #if defined(__COVERITY__)
39 } catch (const std::exception& e) {
40 SAL_WARN("vcl.app", "Fatal exception: " << e.what());
41 std::terminate();
43 #endif
46 virtual bool protect(
47 CppUnit::Functor const & functor, CppUnit::ProtectorContext const &)
48 override
49 { return functor(); }
54 extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector *
55 vclbootstrapprotector() {
56 return new Protector;
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */