diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-11-13 17:24:42 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:17 +0100 |
commit | 6292a51f9666edc8aa6f6d89caf07695387c86e8 (patch) | |
tree | d3af488021f0e589530744234e346c6a5cfc3e6e /vcl/backendtest | |
parent | f670aee88e4630b6cf8ce9f0c077d4dd75791c2e (diff) |
add invert() tests to visualbackendtest
They already exist and are used by the unittest. And the TrackFrame
test actually appears to expect incorrect results (or otherwise pretty
much all backends implement the operation incorrectly).
Change-Id: I26867a2d1b0f01b5e836131932b422cb8823fb5b
Diffstat (limited to 'vcl/backendtest')
-rw-r--r-- | vcl/backendtest/VisualBackendTest.cxx | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index 4110082a6985..cab225918087 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 = 7; + static constexpr unsigned char gnNumberOfTests = 8; unsigned char mnTest; bool mbAnimate; ScopedVclPtr<VirtualDevice> mpVDev; @@ -391,6 +391,43 @@ public: } } + static void testInvert(vcl::RenderContext& rRenderContext, int nWidth, int nHeight) + { + tools::Rectangle aRectangle; + size_t index = 0; + + std::vector<tools::Rectangle> aRegions = setupRegions(2, 2, nWidth, nHeight); + + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_NONE(); + assertAndSetBackground(vcl::test::OutputDeviceTestRect::checkInvertRectangle(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_N50(); + assertAndSetBackground(vcl::test::OutputDeviceTestRect::checkInvertN50Rectangle(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_TrackFrame(); + assertAndSetBackground(vcl::test::OutputDeviceTestRect::checkInvertTrackFrameRectangle(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupXOR(); + assertAndSetBackground(vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } + } + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) override { if (mnTest % gnNumberOfTests == gnNumberOfTests - 1) @@ -487,7 +524,11 @@ public: } else if (mnTest % gnNumberOfTests == 5) { - std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight); + testInvert(rRenderContext, nWidth, nHeight); + } + else if (mnTest % gnNumberOfTests == 6) + { + std::vector<tools::Rectangle> aRegions = setupRegions(3, 1, nWidth, nHeight); aRectangle = aRegions[index++]; { @@ -498,13 +539,6 @@ public: } aRectangle = aRegions[index++]; { - vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; - Bitmap aBitmap = aOutDevTest.setupXOR(); - assertAndSetBackground(vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap), aRectangle, rRenderContext); - drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); - } - aRectangle = aRegions[index++]; - { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradient(); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); |