Package: libreoffice
Version: 4:24.8.3-2
Severity: important
Tags: sid patch
control: affects -1 src:zlib-ng
control: forwarded -1 https://gerrit.libreoffice.org/c/core/+/177440
User: zlib...@tracker.debian.org
Usertags: zlib-ng-ftbfs

The testsuite of libreoffice fails if zlib-ng is used. One of the tests
creates a png file on the fly and its size is different due the zlib
compression.
The patch attached works around the issue by comparing a less-than value
instead of exact size.

Sebastian
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Tue, 26 Nov 2024 22:57:38 +0100
Subject: [PATCH] vcl/qa/cppunit/GraphicTest: Don't test for the exact size of
 the png file.

Building with zlib-ng instead of zlib leads to the following error in the
testsuite:

| [_RUN_____] testSwappingGraphic_PNG_WithGfxLink::TestBody
| ./vcl/qa/cppunit/GraphicTest.cxx:528:testSwappingGraphic_PNG_WithGfxLink::TestBody
| equality assertion failed
| - Expected: 319
| - Actual  : 318

The different implementation of deflate() leads to a different result.

Use an approximation of the expected size instead of the exact value.

Change-Id: I173164bc3b1e6dd37eb48fe42093527069a54075
Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 vcl/qa/cppunit/GraphicTest.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index 3821c31dcf8e3..f6828ea7d8c7d 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -526,7 +526,8 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappingGraphic_PNG_WithGfxLink)
     BitmapChecksum aChecksumBeforeSwapping = aGraphic.GetChecksum();
 
     CPPUNIT_ASSERT_EQUAL(true, aGraphic.IsGfxLink());
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(319), aGraphic.GetGfxLink().GetDataSize());
+    // Expect the the compressed png is be at least W * H / 2
+    CPPUNIT_ASSERT_LESS(sal_uInt32(120 * 100 / 2), aGraphic.GetGfxLink().GetDataSize());
 
     // We loaded the Graphic and made it available
     CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut());
-- 
2.45.2

Reply via email to