vcl/qa/cppunit/pdfexport/data/tdf160401.pptx |binary vcl/qa/cppunit/pdfexport/pdfexport.cxx | 32 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
New commits: commit 96f22f5e5302e030fcbc939ef94b7c1fd2748df2 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jun 13 13:18:59 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 13 15:28:10 2024 +0200 tdf#160401: vcl_pdfexport: Add unittest Change-Id: I92649734bad553d07e0b37d80f804638aacd89fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168780 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/vcl/qa/cppunit/pdfexport/data/tdf160401.pptx b/vcl/qa/cppunit/pdfexport/data/tdf160401.pptx new file mode 100644 index 000000000000..7da2c7a10891 Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf160401.pptx differ diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 50a4f7041017..054496ee4895 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -1258,6 +1258,38 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf150846) CPPUNIT_ASSERT_EQUAL(u"hello"_ustr, aActualText); } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160401) +{ + aMediaDescriptor[u"FilterName"_ustr] <<= u"impress_pdf_Export"_ustr; + saveAsPDF(u"tdf160401.pptx"); + + // Parse the export result with pdfium. + std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(); + + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); + CPPUNIT_ASSERT(pPdfPage); + + std::unique_ptr<vcl::pdf::PDFiumTextPage> pPdfTextPage = pPdfPage->getTextPage(); + CPPUNIT_ASSERT(pPdfTextPage); + + int nChars = pPdfTextPage->countChars(); + + CPPUNIT_ASSERT_EQUAL(16, nChars); + + std::vector<sal_uInt32> aChars(nChars); + for (int i = 0; i < nChars; i++) + aChars[i] = pPdfTextPage->getUnicode(i); + OUString aActualText(aChars.data(), aChars.size()); + + // Without the fix in place, this test would have failed with + // - Expected: אאא בבב + // אאא בבב + // - Actual : אאא בבב + // בבב אאא + CPPUNIT_ASSERT_EQUAL(u"אאא בבב אאא בבב"_ustr, aActualText); +} + CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf103492) { // Import the bugdoc and export as PDF.