vcl/qa/cppunit/pdfexport/pdfexport2.cxx |   28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

New commits:
commit ffcd44ce7c109ca6daf9b9a339609af92f163ecf
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Aug 27 15:52:27 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Aug 28 11:31:46 2024 +0200

    vcl: fix testMultiPagePDF with zlib-ng
    
    After upgrading to Fedora 40, which replaced zlib with zlib-ng, this
    test fails on different compressed stream sizes, but the uncompressed
    content of the stream is the same as before (only checked first one).
    
      vcl/qa/cppunit/pdfexport/pdfexport2.cxx:808:(anonymous 
namespace)::testMultiPagePDF::TestBody
      equality assertion failed
      - Expected: 230
      - Actual  : 228
    
    Change-Id: I27a6d4ac47691258793e18442fb1b59ac1b581c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172471
    Reviewed-by: David Gilbert <freedesk...@treblig.org>
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index c3660e5a9c13..43e3e16ec034 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -804,8 +804,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF)
         SvMemoryStream& rObjectStream = pStream->GetMemory();
         rObjectStream.Seek(STREAM_SEEK_TO_BEGIN);
 
+        SvMemoryStream aUncompressed;
+        ZCodec aZCodec;
+        aZCodec.BeginCompression();
+        aZCodec.Decompress(rObjectStream, aUncompressed);
+        CPPUNIT_ASSERT(aZCodec.EndCompression());
+
         // Just check that the size of the page stream is what is expected.
-        CPPUNIT_ASSERT_EQUAL(sal_uInt64(230), rObjectStream.remainingSize());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt64(1236), aUncompressed.Tell());
     }
 
     { // embedded PDF page 2
@@ -833,8 +839,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF)
         SvMemoryStream& rObjectStream = pStream->GetMemory();
         rObjectStream.Seek(STREAM_SEEK_TO_BEGIN);
 
-        // Just check that the size of the page stream is what is expected
-        CPPUNIT_ASSERT_EQUAL(sal_uInt64(309), rObjectStream.remainingSize());
+        SvMemoryStream aUncompressed;
+        ZCodec aZCodec;
+        aZCodec.BeginCompression();
+        aZCodec.Decompress(rObjectStream, aUncompressed);
+        CPPUNIT_ASSERT(aZCodec.EndCompression());
+
+        // Just check that the size of the page stream is what is expected.
+        CPPUNIT_ASSERT_EQUAL(sal_uInt64(3911), aUncompressed.Tell());
     }
 
     { // embedded PDF page 3
@@ -862,8 +874,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF)
         SvMemoryStream& rObjectStream = pStream->GetMemory();
         rObjectStream.Seek(STREAM_SEEK_TO_BEGIN);
 
-        // Just check that the size of the page stream is what is expected
-        CPPUNIT_ASSERT_EQUAL(sal_uInt64(193), rObjectStream.remainingSize());
+        SvMemoryStream aUncompressed;
+        ZCodec aZCodec;
+        aZCodec.BeginCompression();
+        aZCodec.Decompress(rObjectStream, aUncompressed);
+        CPPUNIT_ASSERT(aZCodec.EndCompression());
+
+        // Just check that the size of the page stream is what is expected.
+        CPPUNIT_ASSERT_EQUAL(sal_uInt64(373), aUncompressed.Tell());
     }
 #endif
 }

Reply via email to