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::test {
17 
23 enum class TestResult
24 {
25  Failed,
27  Passed
28 };
29 
33 {
34 protected:
35 
38 
40  static const Color constLineColor;
41  static const Color constFillColor;
42 
43 public:
45 
46  OUString getRenderBackendName() const;
47 
48  void initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA = false, bool bAlphaVirtualDevice = false);
49 
50  static TestResult checkRectangle(Bitmap& rBitmap);
51  static TestResult checkRectangleAA(Bitmap& rBitmap);
52  static TestResult checkFilledRectangle(Bitmap& rBitmap, bool useLineColor);
53  static TestResult checkLines(Bitmap& rBitmap);
54  static TestResult checkAALines(Bitmap& rBitmap);
55  static TestResult checkDiamond(Bitmap& rBitmap);
56 
57  static TestResult checkInvertRectangle(Bitmap& rBitmap);
58  static TestResult checkInvertN50Rectangle(Bitmap& aBitmap);
59  static TestResult checkInvertTrackFrameRectangle(Bitmap& aBitmap);
60 
61  static TestResult checkRectangles(Bitmap& rBitmap, std::vector<Color>& aExpectedColors);
62  static TestResult checkRectangle(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor);
63 
64  static TestResult checkFilled(Bitmap& rBitmap, tools::Rectangle aRectangle, Color aExpectedColor);
65  static TestResult checkChecker(Bitmap& rBitmap, sal_Int32 nStartX, sal_Int32 nEndX,
66  sal_Int32 nStartY, sal_Int32 nEndY, std::vector<Color> const & rExpected);
67 
68  static void createDiamondPoints(tools::Rectangle rRect, int nOffset,
69  Point& rPoint1, Point& rPoint2,
70  Point& rPoint3, Point& rPoint4);
71 
72  static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect,
73  Point& rHorizontalLinePoint1, Point& rHorizontalLinePoint2,
74  Point& rVerticalLinePoint1, Point& rVerticalLinePoint2,
75  Point& rDiagonalLinePoint1, Point& rDiagonalLinePoint2);
76  // tools
77  static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2);
78 
79  static TestResult checkBezier(Bitmap& rBitmap);
80 };
81 
83 {
84 public:
85  OutputDeviceTestBitmap() = default;
86 
87  Bitmap setupDrawTransformedBitmap();
88  Bitmap setupDrawBitmap();
89  Bitmap setupDrawBitmapExWithAlpha();
90  Bitmap setupDrawMask();
91  BitmapEx setupDrawBlend();
92 
93  static TestResult checkTransformedBitmap(Bitmap& rBitmap);
94  static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap);
95  static TestResult checkMask(Bitmap& rBitmap);
96  static TestResult checkBlend(BitmapEx& rBitmap);
97 };
98 
100 {
101 public:
102  OutputDeviceTestAnotherOutDev() = default;
103 
104  Bitmap setupDrawOutDev();
105  Bitmap setupXOR();
106 
107  static TestResult checkDrawOutDev(Bitmap& rBitmap);
108  static TestResult checkXOR(Bitmap& rBitmap);
109 };
110 
112 {
113 public:
114  OutputDeviceTestPixel() = default;
115 
116  Bitmap setupRectangle(bool bEnableAA);
117 };
118 
120 {
121 public:
122  OutputDeviceTestLine() = default;
123 
124  Bitmap setupRectangle(bool bEnableAA);
125  Bitmap setupDiamond();
126  Bitmap setupLines();
127  Bitmap setupAALines();
128 
129  Bitmap setupDashedLine();
130  static TestResult checkDashedLine(Bitmap& rBitmap);
131 };
132 
134 {
135 public:
136  OutputDeviceTestPolyLine() = default;
137 
138  Bitmap setupRectangle(bool bEnableAA);
139  Bitmap setupDiamond();
140  Bitmap setupLines();
141  Bitmap setupAALines();
142 };
143 
145 {
146 public:
147  OutputDeviceTestPolyLineB2D() = default;
148 
149  Bitmap setupRectangle(bool bEnableAA);
150  Bitmap setupDiamond();
151  Bitmap setupBezier();
152  Bitmap setupAABezier();
153 };
154 
156 {
157 public:
158  OutputDeviceTestRect() = default;
159 
160  Bitmap setupRectangle(bool bEnableAA);
161  Bitmap setupFilledRectangle(bool useLineColor);
162  Bitmap setupInvert_NONE();
163  Bitmap setupInvert_N50();
164  Bitmap setupInvert_TrackFrame();
165 };
166 
168 {
169 public:
170  OutputDeviceTestPolygon() = default;
171 
172  Bitmap setupRectangle(bool bEnableAA);
173  Bitmap setupFilledRectangle(bool useLineColor);
174  Bitmap setupDiamond();
175  Bitmap setupLines();
176  Bitmap setupAALines();
177 };
178 
180 {
181 public:
182  OutputDeviceTestPolyPolygon() = default;
183 
184  Bitmap setupRectangle(bool bEnableAA);
185  Bitmap setupFilledRectangle(bool useLineColor);
186 };
187 
189 {
190 public:
191  OutputDeviceTestPolyPolygonB2D() = default;
192 
193  Bitmap setupRectangle(bool bEnableAA);
194  Bitmap setupFilledRectangle(bool useLineColor);
195 };
196 
198 {
199 public:
200  OutputDeviceTestGradient() = default;
201 
202  Bitmap setupLinearGradient();
203  Bitmap setupRadialGradient();
204 };
205 
207 {
208 public:
209  Bitmap setupClipRectangle();
210  Bitmap setupClipPolygon();
211  Bitmap setupClipPolyPolygon();
212  Bitmap setupClipB2DPolyPolygon();
213 
214  static TestResult checkClip(Bitmap& rBitmap);
215 };
216 
217 
218 } // end namespace vcl::test
219 
220 #endif
221 
222 /* 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.