LibreOffice Module vcl (master)  1
outputdevice.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  */
10 
11 #ifndef INCLUDED_VCL_OUTDEVTESTS_HXX
12 #define INCLUDED_VCL_OUTDEVTESTS_HXX
13 
14 #include <vcl/virdev.hxx>
15 
16 namespace vcl {
17 namespace test {
18 
24 enum class TestResult
25 {
26  Failed,
28  Passed
29 };
30 
34 {
35 protected:
36 
39 
41  static const Color constLineColor;
42  static const Color constFillColor;
43 
44 public:
46 
47  void initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA = false);
48 
49  static TestResult checkRectangle(Bitmap& rBitmap);
50  static TestResult checkRectangleAA(Bitmap& rBitmap);
51  static TestResult checkFilledRectangle(Bitmap& rBitmap);
52  static TestResult checkLines(Bitmap& rBitmap);
53  static TestResult checkAALines(Bitmap& rBitmap);
54  static TestResult checkDiamond(Bitmap& rBitmap);
55 
56  static TestResult checkRectangles(Bitmap& rBitmap, std::vector<Color>& aExpectedColors);
57 
58  static void createDiamondPoints(tools::Rectangle rRect, int nOffset,
59  Point& rPoint1, Point& rPoint2,
60  Point& rPoint3, Point& rPoint4);
61 
62  static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect,
63  Point& rHorizontalLinePoint1, Point& rHorizontalLinePoint2,
64  Point& rVerticalLinePoint1, Point& rVerticalLinePoint2,
65  Point& rDiagonalLinePoint1, Point& rDiagonalLinePoint2);
66  // tools
67  static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2);
68 
69 };
70 
72 {
73 public:
74  OutputDeviceTestBitmap() = default;
75 
76  Bitmap setupDrawTransformedBitmap();
77  Bitmap setupDrawBitmap();
78  Bitmap setupDrawBitmapExWithAlpha();
79  Bitmap setupDrawMask();
80 
81  static TestResult checkTransformedBitmap(Bitmap& rBitmap);
82  static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap);
83  static TestResult checkMask(Bitmap& rBitmap);
84 };
85 
87 {
88 public:
90 
91  Bitmap setupDrawOutDev();
92  Bitmap setupXOR();
93 
94  static TestResult checkDrawOutDev(Bitmap& rBitmap);
95  static TestResult checkXOR(Bitmap& rBitmap);
96 };
97 
99 {
100 public:
101  OutputDeviceTestPixel() = default;
102 
103  Bitmap setupRectangle(bool bEnableAA);
104 };
105 
107 {
108 public:
109  OutputDeviceTestLine() = default;
110 
111  Bitmap setupRectangle(bool bEnableAA);
112  Bitmap setupDiamond();
113  Bitmap setupLines();
114  Bitmap setupAALines();
115 };
116 
118 {
119 public:
120  OutputDeviceTestPolyLine() = default;
121 
122  Bitmap setupRectangle(bool bEnableAA);
123  Bitmap setupDiamond();
124  Bitmap setupLines();
125  Bitmap setupAALines();
126 };
127 
129 {
130 public:
131  OutputDeviceTestPolyLineB2D() = default;
132 
133  Bitmap setupRectangle(bool bEnableAA);
134 };
135 
137 {
138 public:
139  OutputDeviceTestRect() = default;
140 
141  Bitmap setupRectangle(bool bEnableAA);
142  Bitmap setupFilledRectangle();
143 };
144 
146 {
147 public:
148  OutputDeviceTestPolygon() = default;
149 
150  Bitmap setupRectangle(bool bEnableAA);
151  Bitmap setupFilledRectangle();
152  Bitmap setupDiamond();
153  Bitmap setupLines();
154  Bitmap setupAALines();
155 };
156 
158 {
159 public:
160  OutputDeviceTestPolyPolygon() = default;
161 
162  Bitmap setupRectangle(bool bEnableAA);
163  Bitmap setupFilledRectangle();
164 };
165 
167 {
168 public:
169  OutputDeviceTestPolyPolygonB2D() = default;
170 
171  Bitmap setupRectangle(bool bEnableAA);
172  Bitmap setupFilledRectangle();
173 };
174 
176 {
177 public:
178  OutputDeviceTestGradient() = default;
179 
180  Bitmap setupLinearGradient();
181  Bitmap setupRadialGradient();
182 };
183 
184 }} // end namespace vcl::test
185 
186 #endif
187 
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
static const Color constBackgroundColor
ScopedVclPtr< VirtualDevice > mpVirtualDevice
Common subclass for output device rendering tests.
TestResult
Rendering test result.