From 91b4bfee9d52a7aa169eec81aa017d03108e4026 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 22 Aug 2023 15:54:09 +0300 Subject: Enable Skia in unit tests CreateSalInstance will set aUsePlugin to "svp" in case it is in SAL_USE_VCLPLUGIN environment variable (can be controlled using gb_CppunitTest_use_vcl_non_headless in makefiles); when true is returned from Application::IsBitmapRendering(); or when true is returned from IsHeadlessModeRequested() (e.g., when '--headless' is used in the command line). The latter is true for most of the CppunitTests, including CppunitTest_vcl_skia (it may be controlled by gb_CppunitTest_use_vcl_non_headless_with_windows in makefiles). Then this would ensure that Application::EnableBitmapRendering is called. isVCLSkiaEnabled gave false, when Application::IsBitmapRendering was true, which meant that all tests in CppunitTest_vcl_skia effectively didn't run at all. With this change, on platforms where there's no 'svp' plugin, Skia will be enabled in unit tests in software mode: Windows and macOS. Fix bug in a couple of places, where the SkAutoCanvasRestore needs to be destructed before we call other code, otherwise we hit an assert in destroySurface(). Disable the vcl XOR test and CppunitTest_sd_png_export_tests, in skia mode, just so we can just this commit in, that will need further investigation. Tweak assert in addPolygonToPath to account for case where polygon has zero points. Change-Id: Idc0a66d27deb3cf09f631a42bbe037714ebcdc0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155952 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sw/qa') diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index dd1b87f147aa..727146f0b707 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -31,6 +31,7 @@ #include #include #include +#include class Test : public SwModelTestBase { @@ -758,6 +759,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136841, "tdf136841.docx") CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Height()); + // FIXME this still has some issues with skia + if (SkiaHelper::isVCLSkiaEnabled()) + return; + // Without the fix in place, this test would have failed with // - Expected: Color: R:228 G:71 B:69 A:0 // - Actual : Color: R:0 G:0 B:0 A:0 -- cgit