diff options
author | homeboy445 <akshitsan13@gmail.com> | 2021-07-06 14:13:51 +0530 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-08-11 09:25:47 +0200 |
commit | fc8c97f55c509a75ee18de3d9d5e793e37bb0c36 (patch) | |
tree | 86d184aca7db29d6afe1350a6c6615632565cd13 /vcl/backendtest/outputdevice/common.cxx | |
parent | 67329f8b75101a78a00bf646bb2c3b9f4575aa5a (diff) |
backendtest:Irregular HalfEllipse test via various drawing methods
Change-Id: If1a6f224f6ff4118617128630077a81da4c469a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118656
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/backendtest/outputdevice/common.cxx')
-rw-r--r-- | vcl/backendtest/outputdevice/common.cxx | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx index 65507abe018a..570ddb49c544 100644 --- a/vcl/backendtest/outputdevice/common.cxx +++ b/vcl/backendtest/outputdevice/common.cxx @@ -579,6 +579,21 @@ tools::Polygon OutputDeviceTestCommon::createDropShapePolygon() return aPolygon; } +basegfx::B2DPolygon OutputDeviceTestCommon::createHalfEllipsePolygon() +{ + basegfx::B2DPolygon aPolygon; + + aPolygon.append({ 9.0, 1.0 }); + aPolygon.append({ 17.0, 10.0 }); + aPolygon.append({ 1.0, 10.0 }); + aPolygon.setClosed(true); + + aPolygon.setControlPoints(0, { 1.5, 1.5 }, { 16.5, 1.5 }); + + return aPolygon; +} + + TestResult OutputDeviceTestCommon::checkDropShape(Bitmap& rBitmap, bool aEnableAA) { BitmapScopedWriteAccess pAccess(rBitmap); @@ -659,6 +674,55 @@ TestResult OutputDeviceTestCommon::checkBezier(Bitmap& rBitmap) return checkRectangles(rBitmap, aExpected); } +TestResult OutputDeviceTestCommon::checkHalfEllipse(Bitmap& rBitmap, bool aEnableAA) +{ + BitmapScopedWriteAccess pAccess(rBitmap); + + TestResult aResult = TestResult::Passed; + int nNumberOfQuirks = 0; + int nNumberOfErrors = 0; + + std::map<std::pair<tools::Long, tools::Long>, bool> SetPixels = { + { { 8, 1 }, true }, { { 9, 1 }, true }, { { 10, 1 }, true }, { { 6, 2 }, true }, + { { 7, 2 }, true }, { { 10, 2 }, true }, { { 4, 3 }, true }, { { 5, 3 }, true }, + { { 10, 3 }, true }, { { 3, 4 }, true }, { { 10, 4 }, true }, { { 2, 5 }, true }, + { { 10, 5 }, true }, { { 2, 6 }, true }, { { 10, 6 }, true }, { { 1, 7 }, true }, + { { 10, 7 }, true }, { { 1, 8 }, true }, { { 10, 8 }, true }, { { 1, 9 }, true }, + { { 10, 9 }, true }, { { 1, 10 }, true }, { { 10, 10 }, true }, { { 1, 11 }, true }, + { { 10, 11 }, true }, { { 2, 12 }, true }, { { 10, 12 }, true }, { { 2, 13 }, true }, + { { 10, 13 }, true }, { { 3, 14 }, true }, { { 10, 14 }, true }, { { 4, 15 }, true }, + { { 5, 15 }, true }, { { 10, 15 }, true }, { { 6, 16 }, true }, { { 7, 16 }, true }, + { { 10, 16 }, true }, { { 8, 17 }, true }, { { 9, 17 }, true }, { { 10, 17 }, true } + }; + + for (tools::Long x = 0; x < pAccess->Width(); x++) + { + for (tools::Long y = 0; y < pAccess->Height(); ++y) + { + if (SetPixels[{ y, x }]) + { + if (aEnableAA) + checkValueAA(pAccess, x, y, constLineColor, nNumberOfQuirks, nNumberOfErrors); + else + checkValue(pAccess, x, y, constLineColor, nNumberOfQuirks, nNumberOfErrors, + true); + } + else + { + if (!aEnableAA) + checkValue(pAccess, x, y, constBackgroundColor, nNumberOfQuirks, + nNumberOfErrors, true); + } + } + } + + if (nNumberOfQuirks > 0) + aResult = TestResult::PassedWithQuirks; + if (nNumberOfErrors > 0) + aResult = TestResult::Failed; + return aResult; +} + // Check 'count' pixels from (x,y) in (addX,addY) direction, the color values must not decrease. static bool checkGradient(BitmapScopedWriteAccess& pAccess, int x, int y, int count, int addX, int addY) { |