1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #ifndef INCLUDED_VCL_OUTDEVTESTS_HXX
12 #define INCLUDED_VCL_OUTDEVTESTS_HXX
14 #include <vcl/virdev.hxx>
19 /** Rendering test result.
21 * Test either "Passed", "Failed" or "PassedWithQuirks" which means
22 * the test passed but at least one rendering quirk was detected.
31 /** Common subclass for output device rendering tests.
33 class VCL_DLLPUBLIC OutputDeviceTestCommon
37 ScopedVclPtr
<VirtualDevice
> mpVirtualDevice
;
38 tools::Rectangle maVDRectangle
;
40 static const Color constBackgroundColor
;
41 static const Color constLineColor
;
42 static const Color constFillColor
;
45 OutputDeviceTestCommon();
47 void initialSetup(long nWidth
, long nHeight
, Color aColor
, bool bEnableAA
= false);
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
);
56 static TestResult
checkRectangles(Bitmap
& rBitmap
, std::vector
<Color
>& aExpectedColors
);
58 static void createDiamondPoints(tools::Rectangle rRect
, int nOffset
,
59 Point
& rPoint1
, Point
& rPoint2
,
60 Point
& rPoint3
, Point
& rPoint4
);
62 static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect
,
63 Point
& rHorizontalLinePoint1
, Point
& rHorizontalLinePoint2
,
64 Point
& rVerticalLinePoint1
, Point
& rVerticalLinePoint2
,
65 Point
& rDiagonalLinePoint1
, Point
& rDiagonalLinePoint2
);
67 static tools::Rectangle
alignToCenter(tools::Rectangle aRect1
, tools::Rectangle aRect2
);
71 class VCL_DLLPUBLIC OutputDeviceTestBitmap
: public OutputDeviceTestCommon
74 OutputDeviceTestBitmap() = default;
76 Bitmap
setupDrawTransformedBitmap();
77 Bitmap
setupDrawBitmap();
78 Bitmap
setupDrawBitmapExWithAlpha();
79 Bitmap
setupDrawMask();
81 static TestResult
checkTransformedBitmap(Bitmap
& rBitmap
);
82 static TestResult
checkBitmapExWithAlpha(Bitmap
& rBitmap
);
83 static TestResult
checkMask(Bitmap
& rBitmap
);
86 class VCL_DLLPUBLIC OutputDeviceTestAnotherOutDev
: public OutputDeviceTestCommon
89 OutputDeviceTestAnotherOutDev() = default;
91 Bitmap
setupDrawOutDev();
94 static TestResult
checkDrawOutDev(Bitmap
& rBitmap
);
95 static TestResult
checkXOR(Bitmap
& rBitmap
);
98 class VCL_DLLPUBLIC OutputDeviceTestPixel
: public OutputDeviceTestCommon
101 OutputDeviceTestPixel() = default;
103 Bitmap
setupRectangle(bool bEnableAA
);
106 class VCL_DLLPUBLIC OutputDeviceTestLine
: public OutputDeviceTestCommon
109 OutputDeviceTestLine() = default;
111 Bitmap
setupRectangle(bool bEnableAA
);
112 Bitmap
setupDiamond();
114 Bitmap
setupAALines();
117 class VCL_DLLPUBLIC OutputDeviceTestPolyLine
: public OutputDeviceTestCommon
120 OutputDeviceTestPolyLine() = default;
122 Bitmap
setupRectangle(bool bEnableAA
);
123 Bitmap
setupDiamond();
125 Bitmap
setupAALines();
128 class VCL_DLLPUBLIC OutputDeviceTestPolyLineB2D
: public OutputDeviceTestCommon
131 OutputDeviceTestPolyLineB2D() = default;
133 Bitmap
setupRectangle(bool bEnableAA
);
136 class VCL_DLLPUBLIC OutputDeviceTestRect
: public OutputDeviceTestCommon
139 OutputDeviceTestRect() = default;
141 Bitmap
setupRectangle(bool bEnableAA
);
142 Bitmap
setupFilledRectangle();
145 class VCL_DLLPUBLIC OutputDeviceTestPolygon
: public OutputDeviceTestCommon
148 OutputDeviceTestPolygon() = default;
150 Bitmap
setupRectangle(bool bEnableAA
);
151 Bitmap
setupFilledRectangle();
152 Bitmap
setupDiamond();
154 Bitmap
setupAALines();
157 class VCL_DLLPUBLIC OutputDeviceTestPolyPolygon
: public OutputDeviceTestCommon
160 OutputDeviceTestPolyPolygon() = default;
162 Bitmap
setupRectangle(bool bEnableAA
);
163 Bitmap
setupFilledRectangle();
166 class VCL_DLLPUBLIC OutputDeviceTestPolyPolygonB2D
: public OutputDeviceTestCommon
169 OutputDeviceTestPolyPolygonB2D() = default;
171 Bitmap
setupRectangle(bool bEnableAA
);
172 Bitmap
setupFilledRectangle();
175 class VCL_DLLPUBLIC OutputDeviceTestGradient
: public OutputDeviceTestCommon
178 OutputDeviceTestGradient() = default;
180 Bitmap
setupLinearGradient();
181 Bitmap
setupRadialGradient();
184 }} // end namespace vcl::test
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */