diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-07-14 13:01:57 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-07-16 11:55:40 +0200 |
commit | b0ac1fc0e434df76c44f283508e6da8ef7f61278 (patch) | |
tree | e07aef9d12ef120baa78f8533785ad9dc7d5e0f2 /vcl/backendtest | |
parent | e2e66c4a37350155a4dbb6ec5e2811b9f87a6883 (diff) |
sync visualbackendtest and vcl_backend_test
Change-Id: Id3471e2812f2b710d71e748e3542bc8c49dbb7a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98720
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/backendtest')
-rw-r--r-- | vcl/backendtest/VisualBackendTest.cxx | 98 |
1 files changed, 78 insertions, 20 deletions
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index 08efc1d381a3..b3e1b3eb144c 100644 --- a/vcl/backendtest/VisualBackendTest.cxx +++ b/vcl/backendtest/VisualBackendTest.cxx @@ -90,7 +90,7 @@ class VisualBackendTestWindow : public WorkWindow private: Timer maUpdateTimer; std::vector<std::chrono::high_resolution_clock::time_point> mTimePoints; - static constexpr unsigned char gnNumberOfTests = 9; + static constexpr unsigned char gnNumberOfTests = 10; unsigned char mnTest; bool mbAnimate; ScopedVclPtr<VirtualDevice> mpVDev; @@ -155,23 +155,23 @@ public: long x2 = (x+1) * (nWidth / nPartitionsX); long y2 = (y+1) * (nHeight / nPartitionsY); - aRegions.emplace_back(x1 + 1, y1 + 1, x2 - 2, y2 - 2); + aRegions.emplace_back(x1 + 1, y1 + 1, x2 - 6, y2 - 2); } } return aRegions; } - static void testRectangles(vcl::RenderContext& rRenderContext, int nWidth, int nHeight) + static void testRectangles(vcl::RenderContext& rRenderContext, int nWidth, int nHeight, bool AA) { tools::Rectangle aRectangle; size_t index = 0; - std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight); + std::vector<tools::Rectangle> aRegions = setupRegions(4, 2, nWidth, nHeight); aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestRect aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -179,7 +179,7 @@ public: aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestPixel aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -187,7 +187,7 @@ public: aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestLine aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -195,7 +195,7 @@ public: aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestPolygon aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -203,7 +203,15 @@ public: aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestPolyLine aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -211,7 +219,15 @@ public: aRectangle = aRegions[index++]; { vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupRectangle(false); + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(AA); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } @@ -222,7 +238,7 @@ public: tools::Rectangle aRectangle; size_t index = 0; - std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight); + std::vector<tools::Rectangle> aRegions = setupRegions(4, 2, nWidth, nHeight); aRectangle = aRegions[index++]; { @@ -250,6 +266,14 @@ public: aRectangle = aRegions[index++]; { + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + + aRectangle = aRegions[index++]; + { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupFilledRectangle(true); assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true), aRectangle, rRenderContext); @@ -271,14 +295,22 @@ public: assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } + + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(true); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } } - static void testDiamonds(vcl::RenderContext& rRenderContext, int nWidth, int nHeight) + static void testDiamondsAndBezier(vcl::RenderContext& rRenderContext, int nWidth, int nHeight) { tools::Rectangle aRectangle; size_t index = 0; - std::vector<tools::Rectangle> aRegions = setupRegions(3, 1, nWidth, nHeight); + std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight); aRectangle = aRegions[index++]; { @@ -301,6 +333,28 @@ public: assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDiamond(); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupBezier(); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupAABezier(); + assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } } static void testLines(vcl::RenderContext& rRenderContext, int nWidth, int nHeight) @@ -548,34 +602,38 @@ public: if (mnTest % gnNumberOfTests == 0) { - testRectangles(rRenderContext, nWidth, nHeight); + testRectangles(rRenderContext, nWidth, nHeight, false); } else if (mnTest % gnNumberOfTests == 1) { - testFilledRectangles(rRenderContext, nWidth, nHeight); + testRectangles(rRenderContext, nWidth, nHeight, true); } else if (mnTest % gnNumberOfTests == 2) { - testDiamonds(rRenderContext, nWidth, nHeight); + testFilledRectangles(rRenderContext, nWidth, nHeight); } else if (mnTest % gnNumberOfTests == 3) { - testLines(rRenderContext, nWidth, nHeight); + testDiamondsAndBezier(rRenderContext, nWidth, nHeight); } else if (mnTest % gnNumberOfTests == 4) { - testBitmaps(rRenderContext, nWidth, nHeight); + testLines(rRenderContext, nWidth, nHeight); } else if (mnTest % gnNumberOfTests == 5) { - testInvert(rRenderContext, nWidth, nHeight); + testBitmaps(rRenderContext, nWidth, nHeight); } else if (mnTest % gnNumberOfTests == 6) { - testClip(rRenderContext, nWidth, nHeight); + testInvert(rRenderContext, nWidth, nHeight); } else if (mnTest % gnNumberOfTests == 7) { + testClip(rRenderContext, nWidth, nHeight); + } + else if (mnTest % gnNumberOfTests == 8) + { std::vector<tools::Rectangle> aRegions = setupRegions(2, 2, nWidth, nHeight); aRectangle = aRegions[index++]; |