diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-08-15 15:42:30 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-08-16 21:31:21 +0200 |
commit | 7a08c89b5af8f98045ad825ace6be2f035ad91af (patch) | |
tree | 6165f277ed27746ec34f9cda3d1f9df8c8a5f77e /sd | |
parent | 202e68fb4b54f44eb90dc38a554decaac1e0d2c1 (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/PNGExportTests.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
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(); |