[Libreoffice-commits] core.git: Branch 'feature/skia' - 4 commits - vcl/backendtest vcl/inc vcl/qa vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 23 20:16:51 UTC 2019


 vcl/backendtest/outputdevice/common.cxx       |   22 ++
 vcl/backendtest/outputdevice/polyline_b2d.cxx |   79 ++++++++++
 vcl/inc/salgdi.hxx                            |    2 
 vcl/inc/salgdiimpl.hxx                        |    2 
 vcl/inc/skia/gdiimpl.hxx                      |    2 
 vcl/inc/test/outputdevice.hxx                 |    6 
 vcl/qa/cppunit/BackendTest.cxx                |  203 +++++++++++---------------
 vcl/source/gdi/salgdilayout.cxx               |    7 
 8 files changed, 212 insertions(+), 111 deletions(-)

New commits:
commit e3d9aad96c02c80882b7a9d5ef35945681e0aae6
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 23 22:09:55 2019 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed Oct 23 22:14:53 2019 +0200

    backendtests: enable tests only when render backend is skia
    
    Change-Id: Idd06da27e405a3c0040bdad69c76537f12e50c92

diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index a9a8eee977d5..167664d0e3d9 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -10,6 +10,7 @@
 
 #include <test/outputdevice.hxx>
 #include <bitmapwriteaccess.hxx>
+#include <salgdi.hxx>
 
 namespace vcl {
 namespace test {
@@ -225,6 +226,16 @@ OutputDeviceTestCommon::OutputDeviceTestCommon()
     : mpVirtualDevice(VclPtr<VirtualDevice>::Create())
 {}
 
+OUString OutputDeviceTestCommon::getRenderBackendName() const
+{
+    if (mpVirtualDevice && mpVirtualDevice->GetGraphics())
+    {
+        SalGraphics const * pGraphics = mpVirtualDevice->GetGraphics();
+        return pGraphics->getRenderBackendName();
+    }
+    return OUString();
+}
+
 void OutputDeviceTestCommon::initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA)
 {
     maVDRectangle = tools::Rectangle(Point(), Size (nWidth, nHeight));
diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx
index e00dfaad67ce..7c7e71c975e2 100644
--- a/vcl/inc/test/outputdevice.hxx
+++ b/vcl/inc/test/outputdevice.hxx
@@ -44,6 +44,8 @@ protected:
 public:
     OutputDeviceTestCommon();
 
+    OUString getRenderBackendName() const;
+
     void initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA = false);
 
     static TestResult checkRectangle(Bitmap& rBitmap);
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 9836972539b8..f3ba4195d5c3 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -39,12 +39,10 @@ public:
     {
     }
 
-        // We need to enable tests ONE BY ONE as they fail because of backend bugs
-        // it is still important to have the test defined so we know the issues
-        // exist and we need to fix them. Consistent behaviour of our backends
-        // is of highest priority.
-
-#define SKIP_TEST_ASSERTS
+    // We need to enable tests ONE BY ONE as they fail because of backend bugs
+    // it is still important to have the test defined so we know the issues
+    // exist and we need to fix them. Consistent behaviour of our backends
+    // is of highest priority.
 
     void testDrawRectWithRectangle()
     {
@@ -52,10 +50,9 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-01_rectangle_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPixel()
@@ -64,10 +61,9 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-02_rectangle_test-pixel.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithLine()
@@ -76,10 +72,9 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-03_rectangle_test-line.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPolygon()
@@ -88,10 +83,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-04_rectangle_test-polygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPolyLine()
@@ -100,10 +93,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-05_rectangle_test-polyline.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPolyLineB2D()
@@ -112,10 +103,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-06_rectangle_test-polyline_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPolyPolygon()
@@ -124,10 +113,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-07_rectangle_test-polypolygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectWithPolyPolygonB2D()
@@ -136,10 +123,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
         exportImage("01-08_rectangle_test-polypolygon_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithRectangle()
@@ -148,10 +133,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-01_rectangle_AA_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPixel()
@@ -160,10 +143,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-02_rectangle_AA_test-pixel.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithLine()
@@ -172,10 +153,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-03_rectangle_AA_test-line.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPolygon()
@@ -184,10 +163,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-04_rectangle_AA_test-polygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPolyLine()
@@ -196,10 +173,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-05_rectangle_AA_test-polyline.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPolyLineB2D()
@@ -208,10 +183,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-06_rectangle_AA_test-polyline_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPolyPolygon()
@@ -220,10 +193,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-07_rectangle_AA_test-polypolygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawRectAAWithPolyPolygonB2D()
@@ -232,10 +203,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
         exportImage("02-08_rectangle_AA_test-polypolygon_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawFilledRectWithRectangle()
@@ -244,10 +213,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap);
         exportImage("03-01_filled_rectangle_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawFilledRectWithPolygon()
@@ -256,10 +223,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap);
         exportImage("03-02_filled_rectangle_test-polygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawFilledRectWithPolyPolygon()
@@ -268,10 +233,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap);
         exportImage("03-03_filled_rectangle_test-polypolygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawFilledRectWithPolyPolygon2D()
@@ -280,10 +243,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap);
         exportImage("03-04_filled_rectangle_test-polypolygon_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawDiamondWithPolygon()
@@ -292,10 +253,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupDiamond();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap);
         exportImage("04-01_diamond_test-polygon.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawDiamondWithLine()
@@ -304,10 +263,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupDiamond();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap);
         exportImage("04-02_diamond_test-line.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawDiamondWithPolyline()
@@ -316,10 +273,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupDiamond();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap);
         exportImage("04-03_diamond_test-polyline.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawDiamondWithPolylineB2D()
@@ -328,10 +283,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupDiamond();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap);
         exportImage("04-04_diamond_test-polyline_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawInvertWithRectangle()
@@ -340,10 +293,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupInvert_NONE();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertRectangle(aBitmap);
         exportImage("05-01_invert_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawInvertN50WithRectangle()
@@ -352,10 +303,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupInvert_N50();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertN50Rectangle(aBitmap);
         exportImage("05-02_invert_N50_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawInvertTrackFrameWithRectangle()
@@ -364,10 +313,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupInvert_TrackFrame();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertTrackFrameRectangle(aBitmap);
         exportImage("05-03_invert_TrackFrame_test-rectangle.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawBezierWithPolylineB2D()
@@ -376,10 +323,8 @@ public:
         Bitmap aBitmap = aOutDevTest.setupBezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
         exportImage("06-01_bezier_test-polyline_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
     void testDrawBezierAAWithPolylineB2D()
@@ -388,14 +333,10 @@ public:
         Bitmap aBitmap = aOutDevTest.setupAABezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
         exportImage("07-01_bezier_AA_test-polyline_b2d.png", aBitmap);
-        (void)eResult;
-#ifndef SKIP_TEST_ASSERTS
-        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
-#endif
+        if (aOutDevTest.getRenderBackendName() == "skia")
+            CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
     }
 
-#undef SKIP_TEST_ASSERTS
-
     CPPUNIT_TEST_SUITE(BackendTest);
     CPPUNIT_TEST(testDrawRectWithRectangle);
     CPPUNIT_TEST(testDrawRectWithPixel);
commit 7dfda83686cb1597f7581ac23d3b72ce1630f6cd
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 23 22:03:11 2019 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed Oct 23 22:14:53 2019 +0200

    backendtest: Add polyline bezier curve backend tests
    
    Change-Id: I8cb3e97de79cbd683a266b09fb7d194c07b0089f

diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index 919f8f6e623b..a9a8eee977d5 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -442,6 +442,17 @@ void OutputDeviceTestCommon::createHorizontalVerticalDiagonalLinePoints(tools::R
     rDiagonalLinePoint2 = Point(rRect.Right() - 1, rRect.Bottom() - 1);
 }
 
+TestResult OutputDeviceTestCommon::checkBezier(Bitmap& rBitmap)
+{
+    std::vector<Color> aExpected
+    {
+        constBackgroundColor, constBackgroundColor
+    };
+    // Check the bezier doesn't go over to the margins first
+    // TODO extend the check with more exact assert
+    return checkRectangles(rBitmap, aExpected);
+}
+
 }} // end namespace vcl::test
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/backendtest/outputdevice/polyline_b2d.cxx b/vcl/backendtest/outputdevice/polyline_b2d.cxx
index 43b814b2915e..3674fa5d172c 100644
--- a/vcl/backendtest/outputdevice/polyline_b2d.cxx
+++ b/vcl/backendtest/outputdevice/polyline_b2d.cxx
@@ -72,6 +72,58 @@ Bitmap OutputDeviceTestPolyLineB2D::setupDiamond()
 
     return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
 }
+
+Bitmap OutputDeviceTestPolyLineB2D::setupBezier()
+{
+    initialSetup(21, 21, constBackgroundColor, false);
+
+    mpVirtualDevice->SetLineColor(constLineColor);
+    mpVirtualDevice->SetFillColor();
+
+    basegfx::B2DPolygon aPolygon;
+    addDiamondPoints(maVDRectangle, 8, aPolygon);
+    aPolygon.setClosed(true);
+
+    double minX = maVDRectangle.Left() + 4;
+    double maxX = maVDRectangle.Right() - 4;
+    double minY = maVDRectangle.Top() + 4;
+    double maxY = maVDRectangle.Bottom() - 4;
+
+    aPolygon.setControlPoints(0, { minX, minY }, { maxX, minY });
+    aPolygon.setControlPoints(1, { maxX, minY }, { maxX, maxY });
+    aPolygon.setControlPoints(2, { maxX, maxY }, { minX, maxY });
+    aPolygon.setControlPoints(3, { minX, maxY }, { minX, minY });
+
+    mpVirtualDevice->DrawPolyLine(aPolygon);
+
+    return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
+
+Bitmap OutputDeviceTestPolyLineB2D::setupAABezier()
+{
+    initialSetup(21, 21, constBackgroundColor, true);
+
+    mpVirtualDevice->SetLineColor(constLineColor);
+    mpVirtualDevice->SetFillColor();
+
+    basegfx::B2DPolygon aPolygon;
+    addDiamondPoints(maVDRectangle, 8, aPolygon);
+    aPolygon.setClosed(true);
+
+    double minX = maVDRectangle.Left() + 4;
+    double maxX = maVDRectangle.Right() - 4;
+    double minY = maVDRectangle.Top() + 4;
+    double maxY = maVDRectangle.Bottom() - 4;
+
+    aPolygon.setControlPoints(0, { minX, minY }, { maxX, minY });
+    aPolygon.setControlPoints(1, { maxX, minY }, { maxX, maxY });
+    aPolygon.setControlPoints(2, { maxX, maxY }, { minX, maxY });
+    aPolygon.setControlPoints(3, { minX, maxY }, { minX, minY });
+
+    mpVirtualDevice->DrawPolyLine(aPolygon);
+
+    return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
 }
 } // end namespace vcl::test
 
diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx
index 63ad2042fac3..e00dfaad67ce 100644
--- a/vcl/inc/test/outputdevice.hxx
+++ b/vcl/inc/test/outputdevice.hxx
@@ -74,6 +74,7 @@ public:
     // tools
     static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2);
 
+    static TestResult checkBezier(Bitmap& rBitmap);
 };
 
 class VCL_DLLPUBLIC OutputDeviceTestBitmap : public OutputDeviceTestCommon
@@ -140,6 +141,8 @@ public:
 
     Bitmap setupRectangle(bool bEnableAA);
     Bitmap setupDiamond();
+    Bitmap setupBezier();
+    Bitmap setupAABezier();
 };
 
 class VCL_DLLPUBLIC OutputDeviceTestRect : public OutputDeviceTestCommon
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 70eeabb1d6b5..9836972539b8 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -370,6 +370,30 @@ public:
 #endif
     }
 
+    void testDrawBezierWithPolylineB2D()
+    {
+        vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+        Bitmap aBitmap = aOutDevTest.setupBezier();
+        auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
+        exportImage("06-01_bezier_test-polyline_b2d.png", aBitmap);
+        (void)eResult;
+#ifndef SKIP_TEST_ASSERTS
+        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
+#endif
+    }
+
+    void testDrawBezierAAWithPolylineB2D()
+    {
+        vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+        Bitmap aBitmap = aOutDevTest.setupAABezier();
+        auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
+        exportImage("07-01_bezier_AA_test-polyline_b2d.png", aBitmap);
+        (void)eResult;
+#ifndef SKIP_TEST_ASSERTS
+        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
+#endif
+    }
+
 #undef SKIP_TEST_ASSERTS
 
     CPPUNIT_TEST_SUITE(BackendTest);
@@ -405,6 +429,9 @@ public:
     CPPUNIT_TEST(testDrawInvertN50WithRectangle);
     CPPUNIT_TEST(testDrawInvertTrackFrameWithRectangle);
 
+    CPPUNIT_TEST(testDrawBezierWithPolylineB2D);
+    CPPUNIT_TEST(testDrawBezierAAWithPolylineB2D);
+
     CPPUNIT_TEST_SUITE_END();
 };
 
commit 87817f28a4d70a7b3dd15f35269cac578d6ad127
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 23 21:50:12 2019 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed Oct 23 22:14:53 2019 +0200

    backendtest: Add PolyLine B2D test diamond
    
    Change-Id: I6e754e72ff698d62c493b827f9804f63d0e39e2d

diff --git a/vcl/backendtest/outputdevice/polyline_b2d.cxx b/vcl/backendtest/outputdevice/polyline_b2d.cxx
index b59685c7a817..43b814b2915e 100644
--- a/vcl/backendtest/outputdevice/polyline_b2d.cxx
+++ b/vcl/backendtest/outputdevice/polyline_b2d.cxx
@@ -30,6 +30,17 @@ void drawPolyLineOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, in
     rDevice.DrawPolyLine(aPolygon, 0.0); // draw hairline
 }
 
+void addDiamondPoints(tools::Rectangle rRect, int nOffset, basegfx::B2DPolygon& rPolygon)
+{
+    double midPointX = rRect.Left() + (rRect.Right() - rRect.Left()) / 2.0;
+    double midPointY = rRect.Top() + (rRect.Bottom() - rRect.Top()) / 2.0;
+
+    rPolygon.append({ midPointX, midPointY - nOffset });
+    rPolygon.append({ midPointX + nOffset, midPointY });
+    rPolygon.append({ midPointX, midPointY + nOffset });
+    rPolygon.append({ midPointX - nOffset, midPointY });
+}
+
 } // end anonymous namespace
 
 Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
@@ -45,6 +56,22 @@ Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
     return mpVirtualDevice->GetBitmapEx(maVDRectangle.TopLeft(), maVDRectangle.GetSize())
         .GetBitmap();
 }
+
+Bitmap OutputDeviceTestPolyLineB2D::setupDiamond()
+{
+    initialSetup(11, 11, constBackgroundColor);
+
+    mpVirtualDevice->SetLineColor(constLineColor);
+    mpVirtualDevice->SetFillColor();
+
+    basegfx::B2DPolygon aPolygon;
+    addDiamondPoints(maVDRectangle, 4, aPolygon);
+    aPolygon.setClosed(true);
+
+    mpVirtualDevice->DrawPolyLine(aPolygon);
+
+    return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
 }
 } // end namespace vcl::test
 
diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx
index dadc2fc70288..63ad2042fac3 100644
--- a/vcl/inc/test/outputdevice.hxx
+++ b/vcl/inc/test/outputdevice.hxx
@@ -139,6 +139,7 @@ public:
     OutputDeviceTestPolyLineB2D() = default;
 
     Bitmap setupRectangle(bool bEnableAA);
+    Bitmap setupDiamond();
 };
 
 class VCL_DLLPUBLIC OutputDeviceTestRect : public OutputDeviceTestCommon
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 7b3106bdfa59..70eeabb1d6b5 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -322,6 +322,18 @@ public:
 #endif
     }
 
+    void testDrawDiamondWithPolylineB2D()
+    {
+        vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+        Bitmap aBitmap = aOutDevTest.setupDiamond();
+        auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap);
+        exportImage("04-04_diamond_test-polyline_b2d.png", aBitmap);
+        (void)eResult;
+#ifndef SKIP_TEST_ASSERTS
+        CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
+#endif
+    }
+
     void testDrawInvertWithRectangle()
     {
         vcl::test::OutputDeviceTestRect aOutDevTest;
@@ -387,6 +399,7 @@ public:
     CPPUNIT_TEST(testDrawDiamondWithPolygon);
     CPPUNIT_TEST(testDrawDiamondWithLine);
     CPPUNIT_TEST(testDrawDiamondWithPolyline);
+    CPPUNIT_TEST(testDrawDiamondWithPolylineB2D);
 
     CPPUNIT_TEST(testDrawInvertWithRectangle);
     CPPUNIT_TEST(testDrawInvertN50WithRectangle);
commit 82254b798e63be91df0d278af2c8720046232185
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 23 21:38:45 2019 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed Oct 23 22:14:52 2019 +0200

    Add getting of render backend name + impl. for skia
    
    Change-Id: Id4e32425579c2a3ebdc33e234f55a7324dbb39d4

diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index a504fb9fa071..f0aa52e83225 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -416,6 +416,8 @@ public:
                                     sal_uInt8 nTransparency,
                                     const OutputDevice *pOutDev );
 
+    virtual OUString getRenderBackendName() const;
+
     virtual SystemGraphicsData  GetGraphicsData() const = 0;
 
 #if ENABLE_CAIRO_CANVAS
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index d58750f93ea9..0deb2b8612d3 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -49,6 +49,8 @@ public:
 
     virtual void freeResources() = 0;
 
+    virtual OUString getRenderBackendName() const { return OUString(); }
+
     virtual bool setClipRegion( const vcl::Region& ) = 0;
     //
     // get the depth of the device
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 35106dba2ca7..ee9b00ad4ce8 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -39,6 +39,8 @@ public:
 
     virtual void DeInit() override;
 
+    virtual OUString getRenderBackendName() const override { return "skia"; }
+
     const vcl::Region& getClipRegion() const;
     virtual bool setClipRegion(const vcl::Region&) override;
 
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index e1e3c6eabba5..0e07e4b4015c 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -936,4 +936,11 @@ bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight,
     return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency );
 }
 
+OUString SalGraphics::getRenderBackendName() const
+{
+    if (GetImpl())
+        return GetImpl()->getRenderBackendName();
+    return OUString();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list