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>
16
17namespace vcl::test {
18
22{
23protected:
24
27
29 static const Color constLineColor;
30 static const Color constFillColor;
31
32public:
34
35 OUString getRenderBackendName() const;
36
37 void initialSetup(tools::Long nWidth, tools::Long nHeight, Color aColor, bool bEnableAA = false, bool bAlphaVirtualDevice = false);
38
41 static TestResult checkFilledRectangle(Bitmap& rBitmap, bool useLineColor);
42 static TestResult checkLines(Bitmap& rBitmap);
43 static TestResult checkAALines(Bitmap& rBitmap);
44 static TestResult checkDiamond(Bitmap& rBitmap);
45
49
50 static TestResult checkRectangles(Bitmap& rBitmap, std::vector<Color>& aExpectedColors);
51 static TestResult checkRectangle(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor);
52 static TestResult checkRectangles(Bitmap& rBitmap, bool aEnableAA = false);
53
54 static TestResult checkFilled(Bitmap& rBitmap, tools::Rectangle aRectangle, Color aExpectedColor);
55 static TestResult checkChecker(Bitmap& rBitmap, sal_Int32 nStartX, sal_Int32 nEndX,
56 sal_Int32 nStartY, sal_Int32 nEndY, std::vector<Color> const & rExpected);
57
66
67 static void createDiamondPoints(tools::Rectangle rRect, int nOffset,
68 Point& rPoint1, Point& rPoint2,
69 Point& rPoint3, Point& rPoint4);
70
74 static basegfx::B2DPolygon createOpenPolygon(const tools::Rectangle& rRect, int nOffset = 4);
76
78 Point& rHorizontalLinePoint1, Point& rHorizontalLinePoint2,
79 Point& rVerticalLinePoint1, Point& rVerticalLinePoint2,
80 Point& rDiagonalLinePoint1, Point& rDiagonalLinePoint2);
81 // tools
83
84 static TestResult checkBezier(Bitmap& rBitmap);
85
86 static TestResult checkLineCapRound(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_ROUND); }
87 static TestResult checkLineCapSquare(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_SQUARE); }
88 static TestResult checkLineCapButt(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_BUTT); }
89
90 static TestResult checkLineJoinBevel(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Bevel); }
91 static TestResult checkLineJoinRound(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Round); }
92 static TestResult checkLineJoinMiter(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Miter); }
93 static TestResult checkLineJoinNone(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::NONE); }
94 static TestResult checkDropShape(Bitmap& rBitmap, bool aEnableAA = false);
95 static TestResult checkHalfEllipse(Bitmap& rBitmap, bool aEnableAA = false);
100 static TestResult checkIntersectingRecs(Bitmap& rBitmap,int aLayerNumber, Color aExpectedColor);
101 static TestResult checkOpenPolygon(Bitmap& rBitmap, bool aEnableAA = false);
103private:
104 static TestResult checkLineCap(Bitmap& rBitmap, css::drawing::LineCap lineCap);
106};
107
109{
110public:
112
114 bool isBitmapGreyScale = false);
116 bool isBitmapGreyScale = false);
117 Bitmap setupDrawBitmap(vcl::PixelFormat aBitmapFormat, bool isBitmapGreyScale = false);
121
125 static TestResult checkMask(Bitmap& rBitmap);
126 static TestResult checkBlend(const BitmapEx& rBitmap);
127
129};
130
132{
133public:
135
140
144 static TestResult checkXOR(Bitmap& rBitmap);
145};
146
148{
149public:
151
152 Bitmap setupRectangle(bool bEnableAA);
155};
156
158{
159public:
161
162 Bitmap setupRectangle(bool bEnableAA);
168
171
172 Bitmap setupLineCapRound() { return setupLineCap(css::drawing::LineCap_ROUND); }
173 Bitmap setupLineCapSquare() { return setupLineCap(css::drawing::LineCap_SQUARE); }
174 Bitmap setupLineCapButt() { return setupLineCap(css::drawing::LineCap_BUTT); }
175
180private:
181 Bitmap setupLineCap( css::drawing::LineCap lineCap );
183};
184
186{
187public:
189
190 Bitmap setupRectangle(bool bEnableAA);
196 Bitmap setupHalfEllipse(bool aEnableAA = false);
202};
203
205{
206public:
208
209 Bitmap setupRectangle(bool bEnableAA);
213 Bitmap setupHalfEllipse(bool aEnableAA = false);
218};
219
221{
222public:
224
225 Bitmap setupRectangle(bool bEnableAA);
226 Bitmap setupFilledRectangle(bool useLineColor);
232};
233
235{
236public:
238
239 Bitmap setupRectangle(bool bEnableAA);
240 Bitmap setupFilledRectangle(bool useLineColor);
246 Bitmap setupHalfEllipse(bool aEnableAA = false);
252};
253
255{
256public:
258
259 Bitmap setupRectangle(bool bEnableAA);
260 Bitmap setupFilledRectangle(bool useLineColor);
265};
266
268{
269public:
271
272 Bitmap setupRectangle(bool bEnableAA);
273 Bitmap setupFilledRectangle(bool useLineColor);
278};
279
281{
282public:
284
293};
294
296{
297public:
302
303 static TestResult checkClip(Bitmap& rBitmap);
304};
305
307{
308public:
310};
311
312} // end namespace vcl::test
313
314#endif
315
316/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static TestResult checkDrawOutDevSelf(Bitmap &rBitmap)
static TestResult checkDrawOutDevScaledClipped(Bitmap &rBitmap)
static TestResult checkDrawOutDev(Bitmap &rBitmap)
static TestResult checkXOR(Bitmap &rBitmap)
static TestResult checkBitmapExWithAlpha(Bitmap &rBitmap)
Bitmap setupDrawMask(vcl::PixelFormat aBitmapFormat)
Bitmap setupDrawBitmapExWithAlpha(vcl::PixelFormat aBitmapFormat)
Bitmap setupDrawBitmap(vcl::PixelFormat aBitmapFormat, bool isBitmapGreyScale=false)
static TestResult checkBlend(const BitmapEx &rBitmap)
static TestResult checkTransformedBitmap8bppGreyScale(Bitmap &rBitmap)
Bitmap setupDrawTransformedBitmap(vcl::PixelFormat aBitmapFormat, bool isBitmapGreyScale=false)
BitmapEx setupDrawBlend(vcl::PixelFormat aBitmapFormat)
static TestResult checkComplexTransformedBitmap(Bitmap &rBitmap)
Bitmap setupComplexDrawTransformedBitmap(vcl::PixelFormat aBitmapFormat, bool isBitmapGreyScale=false)
static TestResult checkMask(Bitmap &rBitmap)
static TestResult checkTransformedBitmap(Bitmap &rBitmap)
static TestResult checkClip(Bitmap &rBitmap)
Common subclass for output device rendering tests.
static TestResult checkClosedBezier(Bitmap &rBitmap)
static TestResult checkLinearGradient(Bitmap &bitmap)
static TestResult checkOpenBezier(Bitmap &rBitmap)
static TestResult checkBezier(Bitmap &rBitmap)
static TestResult checkEvenOddRuleInIntersectingRecs(Bitmap &rBitmap)
static tools::Polygon createDropShapePolygon()
static TestResult checkFilledRectangle(Bitmap &rBitmap, bool useLineColor)
static TestResult checkTextLocation(Bitmap &rBitmap)
static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2)
static TestResult checkDropShape(Bitmap &rBitmap, bool aEnableAA=false)
static basegfx::B2DPolygon createOpenPolygon(const tools::Rectangle &rRect, int nOffset=4)
static TestResult checkRectangle(Bitmap &rBitmap, int aLayerNumber, Color aExpectedColor)
static TestResult checkInvertN50Rectangle(Bitmap &aBitmap)
static TestResult checkRectangleAA(Bitmap &rBitmap)
static TestResult checkAxialGradient(Bitmap &bitmap)
static TestResult checkInvertRectangle(Bitmap &rBitmap)
static TestResult checkChecker(Bitmap &rBitmap, sal_Int32 nStartX, sal_Int32 nEndX, sal_Int32 nStartY, sal_Int32 nEndY, std::vector< Color > const &rExpected)
static TestResult checkLineJoinMiter(Bitmap &rBitmap)
static TestResult checkFilled(Bitmap &rBitmap, tools::Rectangle aRectangle, Color aExpectedColor)
static basegfx::B2DPolygon createOpenBezier()
static TestResult checkLinearGradientIntensity(Bitmap &bitmap)
static TestResult checkLineJoinBevel(Bitmap &rBitmap)
static TestResult checkOpenPolygon(Bitmap &rBitmap, bool aEnableAA=false)
static TestResult checkLinearGradientAngled(Bitmap &bitmap)
static TestResult checkInvertTrackFrameRectangle(Bitmap &aBitmap)
static TestResult checkLineCapRound(Bitmap &rBitmap)
static TestResult checkFilledAsymmetricalDropShape(Bitmap &rBitmap)
static TestResult checkLineJoinRound(Bitmap &rBitmap)
static const Color constBackgroundColor
static TestResult checkRectangles(Bitmap &rBitmap, bool aEnableAA=false)
static TestResult checkLineJoinNone(Bitmap &rBitmap)
static TestResult checkRadialGradientOfs(Bitmap &bitmap)
static tools::Polygon createClosedBezierLoop(const tools::Rectangle &rRect)
static TestResult checkLineJoin(Bitmap &rBitmap, basegfx::B2DLineJoin lineJoin)
static TestResult checkHalfEllipse(Bitmap &rBitmap, bool aEnableAA=false)
static TestResult checkLinearGradientBorder(Bitmap &bitmap)
static TestResult checkLineCap(Bitmap &rBitmap, css::drawing::LineCap lineCap)
static TestResult checkLineCapButt(Bitmap &rBitmap)
OUString getRenderBackendName() const
void initialSetup(tools::Long nWidth, tools::Long nHeight, Color aColor, bool bEnableAA=false, bool bAlphaVirtualDevice=false)
static TestResult checkAALines(Bitmap &rBitmap)
static TestResult checkRectangles(Bitmap &rBitmap, std::vector< Color > &aExpectedColors)
static TestResult checkRectangle(Bitmap &rBitmap)
static TestResult checkDiamond(Bitmap &rBitmap)
static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect, Point &rHorizontalLinePoint1, Point &rHorizontalLinePoint2, Point &rVerticalLinePoint1, Point &rVerticalLinePoint2, Point &rDiagonalLinePoint1, Point &rDiagonalLinePoint2)
static void createDiamondPoints(tools::Rectangle rRect, int nOffset, Point &rPoint1, Point &rPoint2, Point &rPoint3, Point &rPoint4)
ScopedVclPtr< VirtualDevice > mpVirtualDevice
static TestResult checkRadialGradient(Bitmap &bitmap)
static basegfx::B2DPolygon createHalfEllipsePolygon()
static TestResult checkLines(Bitmap &rBitmap)
static TestResult checkLinearGradientSteps(Bitmap &bitmap)
static TestResult checkIntersectingRecs(Bitmap &rBitmap, int aLayerNumber, Color aExpectedColor)
static TestResult checkLineCapSquare(Bitmap &rBitmap)
Bitmap setupLineJoin(basegfx::B2DLineJoin lineJoin)
Bitmap setupLineCap(css::drawing::LineCap lineCap)
static TestResult checkDashedLine(Bitmap &rBitmap)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupHalfEllipse(bool aEnableAA=false)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupHalfEllipse(bool aEnableAA=false)
Bitmap setupFilledRectangle(bool useLineColor)
Bitmap setupFilledRectangle(bool useLineColor)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupHalfEllipse(bool aEnableAA=false)
Bitmap setupRectangle(bool bEnableAA)
Bitmap setupFilledRectangle(bool useLineColor)
Bitmap setupFilledRectangle(bool useLineColor)
Bitmap setupRectangle(bool bEnableAA)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
Rendering test result.
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:20