diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-10-31 15:31:06 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:15 +0100 |
commit | 0a3d3410da484acde7ac2e08ed8ec6b45ca69276 (patch) | |
tree | 301e8e59d07dd4e964cb847a3c3cbdb6d1beb908 | |
parent | 66853e04a049085ace924827a734e459649fdb2f (diff) |
extend vcl backendtest to more backends
At least the KF5/Qt5 VCL plugins passes fine.
Change-Id: I033ddf6ae9cc663729ca459cdc514dc0fa51ddc2
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/opengl/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Graphics.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5SvpGraphics.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/inc/salgdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/genpspgraphics.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 4 | ||||
-rw-r--r-- | vcl/qa/cppunit/BackendTest.cxx | 82 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.hxx | 2 |
11 files changed, 67 insertions, 34 deletions
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 5dc136f6058c..444169009e5e 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -261,6 +261,7 @@ public: virtual SystemGraphicsData GetGraphicsData() const override; + virtual OUString getRenderBackendName() const override { return "svp"; } #if ENABLE_CAIRO_CANVAS virtual bool SupportsCairo() const override; diff --git a/vcl/inc/opengl/gdiimpl.hxx b/vcl/inc/opengl/gdiimpl.hxx index 95e3aa261472..2deba40eba53 100644 --- a/vcl/inc/opengl/gdiimpl.hxx +++ b/vcl/inc/opengl/gdiimpl.hxx @@ -198,6 +198,8 @@ public: virtual void freeResources() override; + virtual OUString getRenderBackendName() const override { return "opengl"; } + const vcl::Region& getClipRegion() const; virtual bool setClipRegion( const vcl::Region& ) override; diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx index a7c7aaa727ac..d11297bf335e 100644 --- a/vcl/inc/qt5/Qt5Graphics.hxx +++ b/vcl/inc/qt5/Qt5Graphics.hxx @@ -80,6 +80,7 @@ public: virtual SalGraphicsImpl* GetImpl() const override; virtual SystemGraphicsData GetGraphicsData() const override; virtual bool supportsOperation(OutDevSupportType) const override; + virtual OUString getRenderBackendName() const override { return "qt5"; } #if ENABLE_CAIRO_CANVAS virtual bool SupportsCairo() const override; diff --git a/vcl/inc/qt5/Qt5SvpGraphics.hxx b/vcl/inc/qt5/Qt5SvpGraphics.hxx index 0c2485f2a7ed..895023033468 100644 --- a/vcl/inc/qt5/Qt5SvpGraphics.hxx +++ b/vcl/inc/qt5/Qt5SvpGraphics.hxx @@ -46,6 +46,8 @@ public: #endif // ENABLE_CAIRO_CANVAS virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + + virtual OUString getRenderBackendName() const override { return "qt5svp"; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 338878e79529..48ae50e2c68c 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -387,6 +387,7 @@ public: GetTextLayout(int nFallbackLevel) override; virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; + virtual OUString getRenderBackendName() const override { return "aqua"; } virtual SystemGraphicsData GetGraphicsData() const override; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 2a314ed207c1..432dbdb7ec0d 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -50,7 +50,7 @@ public: virtual void freeResources() = 0; - virtual OUString getRenderBackendName() const { return OUString(); } + virtual OUString getRenderBackendName() const = 0; virtual bool setClipRegion( const vcl::Region& ) = 0; // diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h index ed735474d443..b820c43a2772 100644 --- a/vcl/inc/unx/genpspgraphics.h +++ b/vcl/inc/unx/genpspgraphics.h @@ -193,6 +193,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const override; + virtual OUString getRenderBackendName() const override { return "genpsp"; } + #if ENABLE_CAIRO_CANVAS virtual bool SupportsCairo() const override; virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override; diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index cd9cf4c5b562..022a72321873 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -131,6 +131,8 @@ public: virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + virtual OUString getRenderBackendName() const override { return "gtk3svp"; } + GtkStyleContext* createStyleContext(gtk_widget_path_iter_set_object_nameFunc set_object_name, GtkControlPart ePart); GtkStyleContext* createNewContext(GtkControlPart ePart, gtk_widget_path_iter_set_object_nameFunc set_object_name); GtkStyleContext* createOldContext(GtkControlPart ePart); @@ -293,6 +295,8 @@ public: virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; + virtual OUString getRenderBackendName() const override { return "gtk3"; } + protected: std::unique_ptr<GdkX11Pixmap> NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor = 0 ); diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx index 928d7746827b..a36c0faa5568 100644 --- a/vcl/qa/cppunit/BackendTest.cxx +++ b/vcl/qa/cppunit/BackendTest.cxx @@ -55,6 +55,22 @@ public: // exist and we need to fix them. Consistent behaviour of our backends // is of highest priority. + static bool assertBackendNameNotEmpty(const OUString& name) + { + // This ensures that all backends return a valid name. + assert(!name.isEmpty()); + return false; + } + +// Check whether tests should fail depending on which backend is used +// (not all work). If you want to disable just a specific test +// for a specific backend, use something like +// 'if(SHOULD_ASSERT && aOutDevTest.getRenderBackendName() != "skia")'. +#define SHOULD_ASSERT \ + (assertBackendNameNotEmpty(aOutDevTest.getRenderBackendName()) \ + || aOutDevTest.getRenderBackendName() == "skia" \ + || aOutDevTest.getRenderBackendName() == "qt5svp") + void testDrawRectWithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; @@ -62,7 +78,7 @@ public: auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-01_rectangle_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -73,7 +89,7 @@ public: auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-02_rectangle_test-pixel.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -84,7 +100,7 @@ public: auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-03_rectangle_test-line.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -94,7 +110,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(false); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-04_rectangle_test-polygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -104,7 +120,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(false); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-05_rectangle_test-polyline.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -114,7 +130,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(false); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-06_rectangle_test-polyline_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -124,7 +140,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(false); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-07_rectangle_test-polypolygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -134,7 +150,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(false); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); exportImage("01-08_rectangle_test-polypolygon_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -144,7 +160,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-01_rectangle_AA_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -154,7 +170,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-02_rectangle_AA_test-pixel.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -164,7 +180,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-03_rectangle_AA_test-line.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -174,7 +190,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-04_rectangle_AA_test-polygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -184,7 +200,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-05_rectangle_AA_test-polyline.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -194,7 +210,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-06_rectangle_AA_test-polyline_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -204,7 +220,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-07_rectangle_AA_test-polypolygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -214,7 +230,7 @@ public: Bitmap aBitmap = aOutDevTest.setupRectangle(true); auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); exportImage("02-08_rectangle_AA_test-polypolygon_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -224,7 +240,7 @@ public: Bitmap aBitmap = aOutDevTest.setupFilledRectangle(); auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap); exportImage("03-01_filled_rectangle_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -234,7 +250,7 @@ public: Bitmap aBitmap = aOutDevTest.setupFilledRectangle(); auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap); exportImage("03-02_filled_rectangle_test-polygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -244,7 +260,7 @@ public: Bitmap aBitmap = aOutDevTest.setupFilledRectangle(); auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap); exportImage("03-03_filled_rectangle_test-polypolygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -254,7 +270,7 @@ public: Bitmap aBitmap = aOutDevTest.setupFilledRectangle(); auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap); exportImage("03-04_filled_rectangle_test-polypolygon_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -264,7 +280,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDiamond(); auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); exportImage("04-01_diamond_test-polygon.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -274,7 +290,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDiamond(); auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); exportImage("04-02_diamond_test-line.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -284,7 +300,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDiamond(); auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); exportImage("04-03_diamond_test-polyline.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -294,7 +310,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDiamond(); auto eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); exportImage("04-04_diamond_test-polyline_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -304,7 +320,7 @@ public: Bitmap aBitmap = aOutDevTest.setupInvert_NONE(); auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertRectangle(aBitmap); exportImage("05-01_invert_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -314,7 +330,7 @@ public: Bitmap aBitmap = aOutDevTest.setupInvert_N50(); auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertN50Rectangle(aBitmap); exportImage("05-02_invert_N50_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -324,7 +340,7 @@ public: Bitmap aBitmap = aOutDevTest.setupInvert_TrackFrame(); auto eResult = vcl::test::OutputDeviceTestCommon::checkInvertTrackFrameRectangle(aBitmap); exportImage("05-03_invert_TrackFrame_test-rectangle.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -334,7 +350,7 @@ public: Bitmap aBitmap = aOutDevTest.setupBezier(); auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); exportImage("06-01_bezier_test-polyline_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -344,7 +360,7 @@ public: Bitmap aBitmap = aOutDevTest.setupAABezier(); auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); exportImage("07-01_bezier_AA_test-polyline_b2d.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -354,7 +370,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDrawBitmap(); exportImage("08-01_bitmap_test.png", aBitmap); auto eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -364,7 +380,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap(); auto eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); exportImage("08-02_transformed_bitmap_test.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -374,7 +390,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha(); auto eResult = vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap); exportImage("08-03_bitmapex_with_alpha_test.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } @@ -384,7 +400,7 @@ public: Bitmap aBitmap = aOutDevTest.setupDrawMask(); auto eResult = vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap); exportImage("08-04_mask_test.png", aBitmap); - if (aOutDevTest.getRenderBackendName() == "skia") + if (SHOULD_ASSERT) CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed); } diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index d40c31692ea9..6660e191342d 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -112,6 +112,8 @@ public: virtual ~X11SalGraphicsImpl() override; + virtual OUString getRenderBackendName() const override { return "gen"; } + virtual bool setClipRegion( const vcl::Region& ) override; // // get the depth of the device diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 53fc4224f69d..3b3b1837b930 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -70,6 +70,8 @@ public: virtual void freeResources() override; + virtual OUString getRenderBackendName() const override { return "gdi"; } + virtual bool setClipRegion( const vcl::Region& ) override; // // get the depth of the device |