bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / test / outputdevice.hxx
blob966cd2b6b09c98f0622a6a96bfe72937cc1f68d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #ifndef INCLUDED_VCL_OUTDEVTESTS_HXX
12 #define INCLUDED_VCL_OUTDEVTESTS_HXX
14 #include <vcl/virdev.hxx>
16 namespace vcl {
17 namespace test {
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.
24 enum class TestResult
26 Failed,
27 PassedWithQuirks,
28 Passed
31 /** Common subclass for output device rendering tests.
33 class VCL_DLLPUBLIC OutputDeviceTestCommon
35 protected:
37 ScopedVclPtr<VirtualDevice> mpVirtualDevice;
38 tools::Rectangle maVDRectangle;
40 static const Color constBackgroundColor;
41 static const Color constLineColor;
42 static const Color constFillColor;
44 public:
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);
66 // tools
67 static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2);
71 class VCL_DLLPUBLIC OutputDeviceTestBitmap : public OutputDeviceTestCommon
73 public:
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
88 public:
89 OutputDeviceTestAnotherOutDev() = default;
91 Bitmap setupDrawOutDev();
92 Bitmap setupXOR();
94 static TestResult checkDrawOutDev(Bitmap& rBitmap);
95 static TestResult checkXOR(Bitmap& rBitmap);
98 class VCL_DLLPUBLIC OutputDeviceTestPixel : public OutputDeviceTestCommon
100 public:
101 OutputDeviceTestPixel() = default;
103 Bitmap setupRectangle(bool bEnableAA);
106 class VCL_DLLPUBLIC OutputDeviceTestLine : public OutputDeviceTestCommon
108 public:
109 OutputDeviceTestLine() = default;
111 Bitmap setupRectangle(bool bEnableAA);
112 Bitmap setupDiamond();
113 Bitmap setupLines();
114 Bitmap setupAALines();
117 class VCL_DLLPUBLIC OutputDeviceTestPolyLine : public OutputDeviceTestCommon
119 public:
120 OutputDeviceTestPolyLine() = default;
122 Bitmap setupRectangle(bool bEnableAA);
123 Bitmap setupDiamond();
124 Bitmap setupLines();
125 Bitmap setupAALines();
128 class VCL_DLLPUBLIC OutputDeviceTestPolyLineB2D : public OutputDeviceTestCommon
130 public:
131 OutputDeviceTestPolyLineB2D() = default;
133 Bitmap setupRectangle(bool bEnableAA);
136 class VCL_DLLPUBLIC OutputDeviceTestRect : public OutputDeviceTestCommon
138 public:
139 OutputDeviceTestRect() = default;
141 Bitmap setupRectangle(bool bEnableAA);
142 Bitmap setupFilledRectangle();
145 class VCL_DLLPUBLIC OutputDeviceTestPolygon : public OutputDeviceTestCommon
147 public:
148 OutputDeviceTestPolygon() = default;
150 Bitmap setupRectangle(bool bEnableAA);
151 Bitmap setupFilledRectangle();
152 Bitmap setupDiamond();
153 Bitmap setupLines();
154 Bitmap setupAALines();
157 class VCL_DLLPUBLIC OutputDeviceTestPolyPolygon : public OutputDeviceTestCommon
159 public:
160 OutputDeviceTestPolyPolygon() = default;
162 Bitmap setupRectangle(bool bEnableAA);
163 Bitmap setupFilledRectangle();
166 class VCL_DLLPUBLIC OutputDeviceTestPolyPolygonB2D : public OutputDeviceTestCommon
168 public:
169 OutputDeviceTestPolyPolygonB2D() = default;
171 Bitmap setupRectangle(bool bEnableAA);
172 Bitmap setupFilledRectangle();
175 class VCL_DLLPUBLIC OutputDeviceTestGradient : public OutputDeviceTestCommon
177 public:
178 OutputDeviceTestGradient() = default;
180 Bitmap setupLinearGradient();
181 Bitmap setupRadialGradient();
184 }} // end namespace vcl::test
186 #endif
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */