sd/qa/unit/PNGExportTests.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
New commits: commit 7a08c89b5af8f98045ad825ace6be2f035ad91af Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Aug 15 15:42:30 2024 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Aug 16 21:31:21 2024 +0200 Workaround a non-antialiased output on one of Windows buildbots Seen as C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/sd/qa/unit/PNGExportTests.cxx(1006) : error : Assertion Test name: testTdf162259::TestBody greater assertion failed Expected greater than: 350 Actual : 271 See e.g. https://ci.libreoffice.org/job/gerrit_windows/183201/consoleFull#-530547713d893063f-7f3d-4b7e-b56f-4e0f225817cd Change-Id: I0042138a728e1ca08c2b142db7f97635bffd7d79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171777 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index d6661d27cab9..305bf108b7b8 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -959,6 +959,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf162259) css::uno::Sequence<css::beans::PropertyValue> aFilterData{ comphelper::makePropertyValue(u"PixelWidth"_ustr, sal_Int32(101)), comphelper::makePropertyValue(u"PixelHeight"_ustr, sal_Int32(151)), + comphelper::makePropertyValue(u"AntiAliasing"_ustr, true), }; css::uno::Sequence<css::beans::PropertyValue> aDescriptor{ @@ -970,6 +971,8 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf162259) xGraphicExporter->filter(aDescriptor); BitmapEx bmp = vcl::PngImageReader(*maTempFile.GetStream(StreamMode::READ)).read(); + std::set<Color> topColors, bottomColors; + tools::Rectangle topX(12, 21, 37, 60); int topNonWhites = 0; tools::Rectangle bottomX(13, 83, 37, 126); @@ -980,26 +983,33 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf162259) { for (tools::Long y = 0; y < bmp.GetSizePixel().Height(); ++y) { + Color color = bmp.GetPixelColor(x, y); if (topX.Contains(Point{ x, y })) { - if (bmp.GetPixelColor(x, y) != COL_WHITE) + topColors.insert(color); + if (color != COL_WHITE) ++topNonWhites; } else if (bottomX.Contains(Point{ x, y })) { - if (bmp.GetPixelColor(x, y) != COL_WHITE) + bottomColors.insert(color); + if (color != COL_WHITE) ++bottomNonWhites; } else { OString msg("Pixel: "_ostr + OString::number(x) + "," + OString::number(y)); - CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), COL_WHITE, bmp.GetPixelColor(x, y)); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), COL_WHITE, color); } } } - CPPUNIT_ASSERT_GREATER(350, topNonWhites); // 399 in my testing - CPPUNIT_ASSERT_GREATER(350, bottomNonWhites); // 362 in my testing + // On tb88, we have a strange output, where top text is not antialiased. + // Then, its reported count is 271. + int expected = topColors.size() > 2 ? 350 : 250; + CPPUNIT_ASSERT_GREATER(expected, topNonWhites); // 399 in my testing + expected = bottomColors.size() > 2 ? 350 : 250; + CPPUNIT_ASSERT_GREATER(expected, bottomNonWhites); // 362 in my testing } CPPUNIT_PLUGIN_IMPLEMENT();