vcl/qa/cppunit/pdfexport/pdfexport2.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 6f5eb77023d50114ae9e837b7d81fe414abbef4a
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Aug 27 15:04:40 2024 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Aug 27 17:21:28 2024 +0200

    vcl: fix testTdf129085
    
    For unclear reasons, after upgrading to Fedora 40 and pulling the latest
    master, testTdf129085 started to fail:
    
     pdfexport2.cxx:328:Assertion
     Test name: (anonymous namespace)::testTdf129085::TestBody
     equality assertion failed
     - Expected: 0x0(Error Area:Io Class:NONE Code:0)
     - Actual  : 0x8203(Error Area:Vcl Class:General Code:3)
    
    The test runs in the libreoffice-24-2 branch, and the difference is that
    in the old brach a JPEG was exported into the PDF as expected, but in
    master a DIB was exported instead, because it turned out to be smaller
    than the JPEG, because the quality level of the JPEG was 90 in master
    and 80 in the old branch, due to the old branch test passing FilterData
    with UseTaggedPDF, which was later removed from the test due to being
    the default.
    
    Pass in an explicit low quality to prevent this problem.
    
    Change-Id: Ic26c25b15fecd52c5195a7d30c603bda34fe88d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172470
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 4895845f4b8c..c3660e5a9c13 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -295,6 +295,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf161346)
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf129085)
 {
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        // if the Quality is too high (like 90) then the image will be a DIB,
+        // not a JPEG! 80 works currently but set it lower to be sure...
+        { "Quality", uno::Any(sal_Int32(50)) },
+    }));
+    aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
+
     vcl::filter::PDFDocument aDocument;
     load(u"tdf129085.docx", aDocument);
 

Reply via email to