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  OUString getRenderBackendName() const;
48 
49  void initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA = false, bool bAlphaVirtualDevice = false);
50 
51  static TestResult checkRectangle(Bitmap& rBitmap);
52  static TestResult checkRectangleAA(Bitmap& rBitmap);
53  static TestResult checkFilledRectangle(Bitmap& rBitmap, bool useLineColor);
54  static TestResult checkLines(Bitmap& rBitmap);
55  static TestResult checkAALines(Bitmap& rBitmap);
56  static TestResult checkDiamond(Bitmap& rBitmap);
57 
58  static TestResult checkInvertRectangle(Bitmap& rBitmap);
59  static TestResult checkInvertN50Rectangle(Bitmap& aBitmap);
60  static TestResult checkInvertTrackFrameRectangle(Bitmap& aBitmap);
61 
62  static TestResult checkRectangles(Bitmap& rBitmap, std::vector<Color>& aExpectedColors);
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 
131 {
132 public:
133  OutputDeviceTestPolyLine() = default;
134 
135  Bitmap setupRectangle(bool bEnableAA);
136  Bitmap setupDiamond();
137  Bitmap setupLines();
138  Bitmap setupAALines();
139 };
140 
142 {
143 public:
144  OutputDeviceTestPolyLineB2D() = default;
145 
146  Bitmap setupRectangle(bool bEnableAA);
147  Bitmap setupDiamond();
148  Bitmap setupBezier();
149  Bitmap setupAABezier();
150 };
151 
153 {
154 public:
155  OutputDeviceTestRect() = default;
156 
157  Bitmap setupRectangle(bool bEnableAA);
158  Bitmap setupFilledRectangle(bool useLineColor);
159  Bitmap setupInvert_NONE();
160  Bitmap setupInvert_N50();
161  Bitmap setupInvert_TrackFrame();
162 };
163 
165 {
166 public:
167  OutputDeviceTestPolygon() = default;
168 
169  Bitmap setupRectangle(bool bEnableAA);
170  Bitmap setupFilledRectangle(bool useLineColor);
171  Bitmap setupDiamond();
172  Bitmap setupLines();
173  Bitmap setupAALines();
174 };
175 
177 {
178 public:
179  OutputDeviceTestPolyPolygon() = default;
180 
181  Bitmap setupRectangle(bool bEnableAA);
182  Bitmap setupFilledRectangle(bool useLineColor);
183 };
184 
186 {
187 public:
188  OutputDeviceTestPolyPolygonB2D() = default;
189 
190  Bitmap setupRectangle(bool bEnableAA);
191  Bitmap setupFilledRectangle(bool useLineColor);
192 };
193 
195 {
196 public:
197  OutputDeviceTestGradient() = default;
198 
199  Bitmap setupLinearGradient();
200  Bitmap setupRadialGradient();
201 };
202 
203 }} // end namespace vcl::test
204 
205 #endif
206 
207 /* 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.