tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / test / source / vclbootstrapprotector.cxx
blob568a1928887e005bb6d5fdb1314f49596ec5fafd
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 <sal/types.h>
14 #include <sal/log.hxx>
15 #include <vcl/svapp.hxx>
16 #include <comphelper/threadpool.hxx>
17 #include "setupvcl.hxx"
19 namespace {
21 class Protector: public CppUnit::Protector {
22 public:
23 Protector() { test::setUpVcl(); }
24 Protector(const Protector&) = delete;
25 Protector& operator=(const Protector&) = delete;
27 private:
28 virtual ~Protector() override {
29 #if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
30 try {
31 #endif
32 DeInitVCL();
33 // for the 6 tests that use it
34 comphelper::ThreadPool::getSharedOptimalPool().shutdown();
35 #if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
36 } catch (const std::exception& e) {
37 SAL_WARN("vcl.app", "Fatal exception: " << e.what());
38 std::terminate();
40 #endif
43 virtual bool protect(
44 CppUnit::Functor const & functor, CppUnit::ProtectorContext const &)
45 override
46 { return functor(); }
51 extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector *
52 vclbootstrapprotector() {
53 return new Protector;
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */