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(tools::Long nWidth, tools::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 TestResult checkLinearGradient(Bitmap& bitmap);
69  static TestResult checkLinearGradientAngled(Bitmap& bitmap);
70  static TestResult checkLinearGradientBorder(Bitmap& bitmap);
71  static TestResult checkLinearGradientIntensity(Bitmap& bitmap);
72  static TestResult checkLinearGradientSteps(Bitmap& bitmap);
73  static TestResult checkAxialGradient(Bitmap& bitmap);
74  static TestResult checkRadialGradient(Bitmap& bitmap);
75  static TestResult checkRadialGradientOfs(Bitmap& bitmap);
76 
77  static void createDiamondPoints(tools::Rectangle rRect, int nOffset,
78  Point& rPoint1, Point& rPoint2,
79  Point& rPoint3, Point& rPoint4);
80 
81  static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect,
82  Point& rHorizontalLinePoint1, Point& rHorizontalLinePoint2,
83  Point& rVerticalLinePoint1, Point& rVerticalLinePoint2,
84  Point& rDiagonalLinePoint1, Point& rDiagonalLinePoint2);
85  // tools
86  static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2);
87 
88  static TestResult checkBezier(Bitmap& rBitmap);
89 };
90 
92 {
93 public:
94  OutputDeviceTestBitmap() = default;
95 
96  Bitmap setupDrawTransformedBitmap();
97  Bitmap setupDrawBitmap();
98  Bitmap setupDrawBitmapExWithAlpha();
99  Bitmap setupDrawMask();
100  BitmapEx setupDrawBlend();
101 
102  static TestResult checkTransformedBitmap(Bitmap& rBitmap);
103  static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap);
104  static TestResult checkMask(Bitmap& rBitmap);
105  static TestResult checkBlend(const BitmapEx& rBitmap);
106 };
107 
109 {
110 public:
111  OutputDeviceTestAnotherOutDev() = default;
112 
113  Bitmap setupDrawOutDev();
114  Bitmap setupXOR();
115 
116  static TestResult checkDrawOutDev(Bitmap& rBitmap);
117  static TestResult checkXOR(Bitmap& rBitmap);
118 };
119 
121 {
122 public:
123  OutputDeviceTestPixel() = default;
124 
125  Bitmap setupRectangle(bool bEnableAA);
126 };
127 
129 {
130 public:
131  OutputDeviceTestLine() = default;
132 
133  Bitmap setupRectangle(bool bEnableAA);
134  Bitmap setupDiamond();
135  Bitmap setupLines();
136  Bitmap setupAALines();
137 
138  Bitmap setupDashedLine();
139  static TestResult checkDashedLine(Bitmap& rBitmap);
140 };
141 
143 {
144 public:
145  OutputDeviceTestPolyLine() = default;
146 
147  Bitmap setupRectangle(bool bEnableAA);
148  Bitmap setupDiamond();
149  Bitmap setupLines();
150  Bitmap setupAALines();
151 };
152 
154 {
155 public:
156  OutputDeviceTestPolyLineB2D() = default;
157 
158  Bitmap setupRectangle(bool bEnableAA);
159  Bitmap setupDiamond();
160  Bitmap setupBezier();
161  Bitmap setupAABezier();
162 };
163 
165 {
166 public:
167  OutputDeviceTestRect() = default;
168 
169  Bitmap setupRectangle(bool bEnableAA);
170  Bitmap setupFilledRectangle(bool useLineColor);
171  Bitmap setupInvert_NONE();
172  Bitmap setupInvert_N50();
173  Bitmap setupInvert_TrackFrame();
174 };
175 
177 {
178 public:
179  OutputDeviceTestPolygon() = default;
180 
181  Bitmap setupRectangle(bool bEnableAA);
182  Bitmap setupFilledRectangle(bool useLineColor);
183  Bitmap setupDiamond();
184  Bitmap setupLines();
185  Bitmap setupAALines();
186 };
187 
189 {
190 public:
191  OutputDeviceTestPolyPolygon() = default;
192 
193  Bitmap setupRectangle(bool bEnableAA);
194  Bitmap setupFilledRectangle(bool useLineColor);
195 };
196 
198 {
199 public:
200  OutputDeviceTestPolyPolygonB2D() = default;
201 
202  Bitmap setupRectangle(bool bEnableAA);
203  Bitmap setupFilledRectangle(bool useLineColor);
204 };
205 
207 {
208 public:
209  OutputDeviceTestGradient() = default;
210 
211  Bitmap setupLinearGradient();
212  Bitmap setupLinearGradientAngled();
213  Bitmap setupLinearGradientBorder();
214  Bitmap setupLinearGradientIntensity();
215  Bitmap setupLinearGradientSteps();
216  Bitmap setupAxialGradient();
217  Bitmap setupRadialGradient();
218  Bitmap setupRadialGradientOfs();
219 };
220 
222 {
223 public:
224  Bitmap setupClipRectangle();
225  Bitmap setupClipPolygon();
226  Bitmap setupClipPolyPolygon();
227  Bitmap setupClipB2DPolyPolygon();
228 
229  static TestResult checkClip(Bitmap& rBitmap);
230 };
231 
232 
233 } // end namespace vcl::test
234 
235 #endif
236 
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
static const Color constBackgroundColor
ScopedVclPtr< VirtualDevice > mpVirtualDevice
Common subclass for output device rendering tests.
TestResult
Rendering test result.