vcl/qa/cppunit/pdfexport/data/tdf147027.ods |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx      |   17 +++++++++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit d0c4b646aa5b90794eb41a8a82db78fa0b8e66da
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Feb 14 19:22:12 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Feb 14 21:08:34 2022 +0100

    tdf#147027: vcl_pdfexport: Add unittest
    
    This is the only way I could find to test this issue
    
    Change-Id: Ib47355562abd69f9d15184e1f044e21da3a87fae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129923
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/qa/cppunit/pdfexport/data/tdf147027.ods 
b/vcl/qa/cppunit/pdfexport/data/tdf147027.ods
new file mode 100644
index 000000000000..24e1fde9ae2f
Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf147027.ods differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 4326b53b80bb..817f836cd260 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1906,6 +1906,23 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testReduceSmallImage)
     CPPUNIT_ASSERT_EQUAL(16, nHeight);
 }
 
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf147027)
+{
+    // Load the Calc document.
+    aMediaDescriptor["FilterName"] <<= OUString("calc_pdf_Export");
+    saveAsPDF(u"tdf147027.ods");
+    std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parseExport();
+    CPPUNIT_ASSERT(pPdfDocument);
+    CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+    std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(/*nIndex=*/0);
+    CPPUNIT_ASSERT(pPdfPage);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 778
+    // - Actual  : 40
+    CPPUNIT_ASSERT_EQUAL(778, pPdfPage->getObjectCount());
+}
+
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testReduceImage)
 {
     // Load the Writer document.

Reply via email to