LibreOffice Module test (master)  1
bootstrapfixture.hxx
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 #pragma once
10 
11 #include <sal/config.h>
12 
13 #include <rtl/string.hxx>
14 #include <tools/link.hxx>
15 #include <vcl/salctype.hxx>
16 #include <com/sun/star/uno/XComponentContext.hpp>
17 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
18 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
19 
20 #include <cppunit/TestAssert.h>
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
23 #include <cppunit/plugin/TestPlugIn.h>
25 #include <test/testdllapi.hxx>
26 
27 namespace test
28 {
30 {
32  ODF,
34 };
35 
36 // Class to do lots of heavy-lifting UNO & environment
37 // bootstrapping for unit tests, such that we can use
38 // almost an entire LibreOffice during compile - so
39 // that we can get pieces of code alone to beat them up.
40 
41 // NB. this class is instantiated multiple times during a
42 // run of unit tests ...
44 {
45  bool m_bNeedUCB;
47 
48 protected:
49  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
50 
51  // A convenience function to be used to conditionally exclude tests not behaving properly
52  // on UI scaling other than 1:1. Using this should be considered a temporary workaround,
53  // until a proper fix is implemented that either considers the DPI properly in the test, or
54  // makes the invariants that test uses independent of DPI.
55  static bool IsDefaultDPI();
56 
57 public:
58  DECL_STATIC_LINK(BootstrapFixture, ImplInitFilterHdl, ConvertData&, bool);
59 
60  BootstrapFixture(bool bAssertOnDialog = true, bool bNeedUCB = true);
61  virtual ~BootstrapFixture() override;
62 
63  virtual void setUp() override;
64 
65  void validate(const OUString& rURL, ValidationFormat) const;
66 
67  // Allows to exclude tests dependent on color depth of the default virtual device
68  static sal_uInt16 getDefaultDeviceBitCount();
69 };
70 }
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
#define OOO_DLLPUBLIC_TEST
Definition: testdllapi.hxx:28