UnoApiTest: pass PDFium to parsePDFExport as parameter

so we can check if it's not a nullptr at test level

Change-Id: Icfe580b27f3ad4a28b328f0fac8cf93e05c50b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210484
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli
2026-09-04 15:32:19 +02:00
parent d3d8cef720
commit eb0c65a1a1
21 changed files with 273 additions and 177 deletions
+1 -1
View File
@@ -692,7 +692,7 @@ void DesktopLOKTest::testSaveAsJsonOptions()
// Then make sure the resulting PDF has 2 pages:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport();
= parsePDFExport(pPDFium);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 2
// - Actual : 3
+3 -1
View File
@@ -183,7 +183,9 @@ public:
const css::uno::Sequence<css::beans::PropertyValue>& rParams = {},
const char* pPassword = nullptr);
std::unique_ptr<vcl::pdf::PDFiumDocument> parsePDFExport(const OString& rPassword = OString());
std::unique_ptr<vcl::pdf::PDFiumDocument>
parsePDFExport(const std::shared_ptr<vcl::pdf::PDFium>& rPDFium,
const OString& rPassword = OString());
void createTempCopy(std::u16string_view fileName);
+8 -8
View File
@@ -219,7 +219,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testHiddenSheetsWithPrintRange)
// Only the two visible sheets reach the PDF, one page each.
// Without the fix the hidden sheets were exported too, giving 4 pages.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
@@ -243,7 +243,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testSinglePagesWithHiddenSheets)
// One page per visible sheet, in sheet order.
// Without the fix the hidden sheets were exported too, giving 4 pages.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
@@ -271,7 +271,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testPopupRectangleSize_Tdf162955)
exportToPDF(xModel, aRange);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -777,7 +777,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testTdf143978)
ScRange range1(0, 0, 0, 0, 1, 0);
exportToPDF(xModel, range1);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -834,7 +834,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testTdf120190)
exportToPDF(xModel, range1);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -885,7 +885,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testTdf84012)
ScRange range1(0, 0, 0, 0, 0, 0);
exportToPDF(xModel, range1);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -920,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testTdf78897)
ScRange range1(2, 2, 0, 3, 2, 0);
exportToPDF(xModel, range1);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -970,7 +970,7 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testTdf156893)
exportToPDF(xModel, range, { comphelper::makePropertyValue(u"SinglePageSheets"_ustr, true) });
// Parse the export result
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
+1 -1
View File
@@ -196,7 +196,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
saveAndReload(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Check PDF for annotations
auto pPDFDocument = parsePDFExport();
auto pPDFDocument = parsePDFExport(pPdfium);
CPPUNIT_ASSERT(pPDFDocument);
CPPUNIT_ASSERT_EQUAL(1, pPDFDocument->getPageCount());
+5 -5
View File
@@ -34,6 +34,10 @@ public:
CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// Given a Calc document with a chart in it:
loadFromFile(u"chart.ods");
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
@@ -48,11 +52,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
// Then make sure we get a valid, non-empty PDF:
// Without the accompanying fix in place, this test would have failed, because the output was
// empty (0 bytes).
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
if (!pPdfDocument)
{
return;
}
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
int nPageCount = pPdfDocument->getPageCount();
CPPUNIT_ASSERT_GREATER(0, nPageCount);
}
+5 -5
View File
@@ -649,6 +649,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot)
CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// Given a document with 2 pages, first page footer has an off-page line shape:
loadFromFile(u"page-view-draw-layer-clip.docx");
@@ -656,11 +660,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
save(TestFilter::PDF_WRITER);
// Then make sure that line shape gets clipped:
std::unique_ptr<vcl::pdf::PDFiumDocument> pDoc = parsePDFExport();
if (!pDoc)
{
return;
}
std::unique_ptr<vcl::pdf::PDFiumDocument> pDoc = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage1 = pDoc->openPage(0);
CPPUNIT_ASSERT_EQUAL(3, pPage1->getObjectCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPage2 = pDoc->openPage(1);
+9 -9
View File
@@ -153,6 +153,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFlyMinimalWrap)
CPPUNIT_TEST_FIXTURE(Test, testContentControlHeaderPDFExport)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// Given a document with a content control in the header:
createSwDoc("content-control-header.docx");
@@ -160,11 +164,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlHeaderPDFExport)
save(TestFilter::PDF_WRITER);
// Then make sure all the expected text is there on page 2:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
if (!pPdfDocument)
{
return;
}
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage2 = pPdfDocument->openPage(1);
int nTextCount = 0;
for (int i = 0; i < pPage2->getObjectCount(); ++i)
@@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCheckedCheckboxContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a checked checkbox form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnotation = pPage->getAnnotation(0);
@@ -262,7 +262,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFFontColor)
save(TestFilter::PDF_WRITER);
// Then make sure that the widget in the PDF result has that custom font color:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
pPage->onAfterLoadPage(pPdfDocument.get());
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
@@ -316,7 +316,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFDropDownText)
save(TestFilter::PDF_WRITER);
// Then make sure that the custom default is not lost:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
pPage->onAfterLoadPage(pPdfDocument.get());
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
@@ -354,7 +354,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFComments)
});
// Then make sure the only widget for the content control has a correct position:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
pPage->onAfterLoadPage(pPdfDocument.get());
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
+17 -17
View File
@@ -285,7 +285,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
save(TestFilter::PDF_WRITER);
// Then make sure the field links the source.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
// Without the accompanying fix in place, this test would have failed, the field was not
// clickable (while it was clickable on the UI).
@@ -323,7 +323,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport2)
// Then make sure the field links when the Target URL is set
// (this test is important, isn't the same as the one above)
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage->hasLinks());
}
@@ -358,7 +358,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport3)
save(TestFilter::PDF_WRITER);
// Then make sure there are no links since UseTargetURL is not set
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(!pPdfPage->hasLinks());
}
@@ -394,7 +394,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport4)
save(TestFilter::PDF_WRITER);
// Then make sure the field links when the Target URL is set
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage->hasLinks());
}
@@ -439,7 +439,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport5)
save(TestFilter::PDF_WRITER);
// Then make sure the mark links to the table when table is present
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage->hasLinks());
}
@@ -534,7 +534,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport6)
save(TestFilter::PDF_WRITER);
// Then make sure the mark links to the table even when format contains tab stop
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage->hasLinks());
}
@@ -1064,7 +1064,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a fillable form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1095,7 +1095,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPlaceholderPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a fillable form widget is emitted with the expected value:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnotation = pPage->getAnnotation(0);
@@ -1123,7 +1123,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a checkbox form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1153,7 +1153,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a dropdown form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1179,7 +1179,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF2)
save(TestFilter::PDF_WRITER);
// Make sure that a dropdown form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT_EQUAL(4, pPage->getAnnotationCount());
@@ -1208,7 +1208,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDateContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a date form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1246,7 +1246,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDFFont)
save(TestFilter::PDF_WRITER);
// Then make sure that the widget in the PDF result has that custom font size:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
pPage->onAfterLoadPage(pPdfDocument.get());
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
@@ -1274,7 +1274,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testComboContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a combo box form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1317,7 +1317,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRichContentControlPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a single fillable form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1340,7 +1340,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testPlaceholderFieldPDF)
save(TestFilter::PDF_WRITER);
// Then make sure that a fillable form widget is emitted:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -1708,7 +1708,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf161990)
// When exporting to PDF:
save(TestFilter::PDF_WRITER);
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(pPDFium);
// Check that both subscripts are positioned correctly relative to the non-subscript runs
double expectedOffset = 0;
+8 -10
View File
@@ -1414,12 +1414,10 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport)
skipValidation();
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
// Non-NULL pPdfDocument means pdfium is available.
if (pPdfDocument != nullptr)
if (std::shared_ptr<vcl::pdf::PDFium> pPDFium
= vcl::pdf::PDFiumLibrary::get()) // This part will be skipped without PDFium
{
auto pPdfDocument = parsePDFExport(pPDFium);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -1802,6 +1800,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTableOfContentLinksHaveContentSet)
// TOC is expected to have alt. text set (written to /Contents key), PDF/UA conformance tests
// will fail. TOC links can't be set by the user.
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
createSwDoc("SimpleTOC.odt");
// Let's update TOC first
@@ -1821,11 +1823,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableOfContentLinksHaveContentSet)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
// Non-NULL pPdfDocument means pdfium is available.
if (!pPdfDocument)
return;
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+10 -6
View File
@@ -2117,6 +2117,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf171959ManyBlanks)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTrailingBlankInUntaggedPdf)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// The same centred line ending in many blanks, this time exported to PDF with tagging off.
createSwDoc();
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
@@ -2128,9 +2132,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTrailingBlankInUntaggedPdf)
u"FilterData"_ustr,
comphelper::InitPropertySequence({ { "UseTaggedPDF", uno::Any(false) } })) });
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport();
if (!pPdf)
return;
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdf->openPage(0);
int nText = 0;
int nPath = 0;
@@ -2159,6 +2161,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTrailingBlankInUntaggedPdf)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf32181)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// A justified, underlined paragraph: the attachment of tdf#32181 / i68503, with its font
// changed to a bundled one. Justification stretches the blank each line ends in, and the blank
// used to be underlined, so the underline ran off to the right well past the margin.
@@ -2168,9 +2174,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf32181)
u"FilterData"_ustr,
comphelper::InitPropertySequence({ { "UseTaggedPDF", uno::Any(false) } })) });
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport();
if (!pPdf)
return;
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdf->openPage(0);
// The page is 21 cm wide with a 2 cm right margin, so text ends here. An underline is drawn a
+5 -3
View File
@@ -1613,6 +1613,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testCool16067_footnoteSpaceFreedBySplit)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testCool16071_footnoteTailKeptWhenTruncated)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
// The first row's footnote fills the footnote area of the page it ends up on, and the last
// row travels between pages carrying a footnote of three lines. That leaves the lines after
// the first formatted against a footnote area with no room for them.
@@ -1620,9 +1624,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testCool16071_footnoteTailKeptWhenTruncate
// A layout dump would format what it reads, and that alone repairs the frame: measure the
// export instead.
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport();
if (!pPdf)
return;
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdf = parsePDFExport(pPDFium);
// the last word of the last footnote, on its third line
bool bTailExported = false;
+6 -2
View File
@@ -573,8 +573,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf163194)
comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL()) };
dispatchCommand(mxComponent, u".uno:ExportToPDF"_ustr, aDescriptor);
if (auto pPdfDocument = parsePDFExport()) // This part will be skipped without PDFium
if (std::shared_ptr<vcl::pdf::PDFium> pPDFium
= vcl::pdf::PDFiumLibrary::get()) // This part will be skipped without PDFium
{
auto pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
auto pPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPage);
@@ -694,8 +696,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf111880RtlPageCommentsOnLeftSide)
comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL()) };
dispatchCommand(mxComponent, u".uno:ExportToPDF"_ustr, aDescriptor);
if (auto pPdfDocument = parsePDFExport()) // This part will be skipped without PDFium
if (std::shared_ptr<vcl::pdf::PDFium> pPDFium
= vcl::pdf::PDFiumLibrary::get()) // This part will be skipped without PDFium
{
auto pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
auto pPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPage);
+1 -1
View File
@@ -3221,7 +3221,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testConditionalHiddenSectionIssue)
// PDF export
save(TestFilter::PDF_WRITER);
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(pPDFium);
auto pPdfPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPdfPage);
+4 -4
View File
@@ -689,7 +689,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145584)
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
});
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -722,7 +722,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf131728)
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
});
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -761,7 +761,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf95239)
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
});
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -814,7 +814,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf152575)
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
});
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(3, pPdfDocument->getPageCount());
int nCommentsCount(0);
+5 -1
View File
@@ -767,6 +767,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf111969B)
#if ENABLE_PDFIMPORT
CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testPDFExportCrash)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return;
createSwDoc("section-table-section.fodt");
uno::Sequence<beans::PropertyValue> aFilterData(
@@ -778,7 +782,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testPDFExportCrash)
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
});
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
}
#endif
+5 -8
View File
@@ -403,20 +403,17 @@ void UnoApiTest::saveAndReload(TestFilter eFilter,
loadFromURL(maTempFile.GetURL(), rParams, pPassword);
}
std::unique_ptr<vcl::pdf::PDFiumDocument> UnoApiTest::parsePDFExport(const OString& rPassword)
std::unique_ptr<vcl::pdf::PDFiumDocument>
UnoApiTest::parsePDFExport(const std::shared_ptr<vcl::pdf::PDFium>& rPDFium,
const OString& rPassword)
{
SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
maMemory.WriteStream(aFile);
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
{
return nullptr;
}
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= pPDFium->openDocument(maMemory.GetData(), maMemory.GetSize(), rPassword);
= rPDFium->openDocument(maMemory.GetData(), maMemory.GetSize(), rPassword);
if (!pPdfDocument)
{
OString aError = OUStringToOString(pPDFium->getLastError(), RTL_TEXTENCODING_UTF8);
OString aError = OUStringToOString(rPDFium->getLastError(), RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_MESSAGE(aError.getStr(), pPdfDocument);
}
return pPdfDocument;
+2 -1
View File
@@ -116,7 +116,8 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testPDFAddVisibleSignatureLastPage)
pObjectShell->SignDocumentContentUsingCertificate(aSigningContext);
// Then: count the # of shapes on the signature widget/annotation.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
if (!pPdfDocument)
return;
// Last page.
@@ -81,7 +81,8 @@ CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptionRoundtrip_PDF_1_7)
/*pPassword*/ "secret");
// Load the exported result in PDFium
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"_ostr);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
int nFileVersion = pPdfDocument->getFileVersion();
CPPUNIT_ASSERT_EQUAL(17, nFileVersion);
@@ -99,7 +100,8 @@ CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptionRoundtrip_PDF_2_0)
/*pPassword*/ "secret");
// Load the exported result in PDFium
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"_ostr);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
int nFileVersion = pPdfDocument->getFileVersion();
CPPUNIT_ASSERT_EQUAL(20, nFileVersion);
@@ -133,7 +135,8 @@ CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptionRoundtrip_PDF_2_0_PaddingB
xStorable->storeToURL(maTempFile.GetURL(), maMediaDescriptor.getAsConstPropertyValueList());
// Load the exported result in PDFium and read the link target back
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"_ostr);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPdfPage);
+52 -28
View File
@@ -69,8 +69,6 @@ public:
maMemory.WriteStream(aFile);
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
if (!pPDFium)
return nullptr;
return pPDFium->openDocument(maMemory.GetData(), maMemory.GetSize(), OString());
}
#endif
@@ -87,7 +85,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testPopupRectangleSize)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPdfPage);
@@ -202,7 +201,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testCommentAnnotation)
CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -367,7 +367,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105461)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -538,7 +539,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -565,7 +567,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142741)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(2,
pPdfDocument->getPageCount()); // To ensure that exported pdf has 2 pages
@@ -840,7 +843,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -1020,7 +1024,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf108963)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -1489,7 +1494,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1a)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -1524,7 +1530,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2a)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -1552,7 +1559,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf154549)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -1584,7 +1592,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf150846)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -1610,7 +1619,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160401)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -1643,7 +1653,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf103492)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has two page.
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
@@ -1690,7 +1701,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf145274)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -1725,7 +1737,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf156685)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -2078,7 +2091,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105954)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -2203,7 +2217,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157679)
// Import the bugdoc and export as PDF.
loadFromFile(u"tdf157679.pptx");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -2231,7 +2246,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf128445)
// Import the bugdoc and export as PDF.
loadFromFile(u"tdf128445.odp");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -2255,7 +2271,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf128630)
// Import the bugdoc and export as PDF.
loadFromFile(u"tdf128630.odp");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -2289,7 +2306,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106702)
loadFromFile(u"tdf106702.odt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has two pages.
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
@@ -2346,7 +2364,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143)
loadFromFile(u"tdf113143.odp");
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has two pages.
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
@@ -2430,7 +2449,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115262)
{
loadFromFile(u"tdf115262.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(8, pPdfDocument->getPageCount());
// Get the 6th page.
@@ -2469,7 +2489,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf121962)
{
loadFromFile(u"tdf121962.odt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -2493,7 +2514,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139065)
{
loadFromFile(u"tdf139065.odt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -3910,7 +3932,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115967)
{
loadFromFile(u"tdf115967.odt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Get the first page
@@ -3944,7 +3967,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf167659)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPdfPage);
std::unique_ptr<vcl::pdf::PDFiumTextPage> pPdfTextPage = pPdfPage->getTextPage();
+119 -62
View File
@@ -498,7 +498,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTocLink)
// Save as PDF.
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -515,7 +516,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReduceSmallImage)
// Load the Writer document.
loadFromFile(u"reduce-small-image.fodt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -540,7 +542,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf114256)
{
loadFromFile(u"tdf114256.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -555,7 +558,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf150931)
{
loadFromFile(u"tdf150931.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -605,7 +609,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf147027)
// Load the Calc document.
loadFromFile(u"tdf147027.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -621,7 +626,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135346)
// Load the Calc document.
loadFromFile(u"tdf135346.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -636,7 +642,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf147164)
{
loadFromFile(u"tdf147164.odp");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/1);
CPPUNIT_ASSERT(pPdfPage);
@@ -675,7 +682,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReduceImage)
aOutputStream.Close();
// Parse the PDF: get the image.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -701,7 +709,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testLinkWrongPage)
// Import the bugdoc and export as PDF.
loadFromFile(u"link-wrong-page.odp");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has 2 pages.
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
@@ -733,7 +742,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testLinkWrongPagePartial)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Then make sure the we have a link on the 1st page, but not on the 2nd one:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -756,7 +766,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPageRange)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Then make sure the resulting PDF has 2 pages:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 2
// - Actual : 3
@@ -769,7 +780,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testLargePage)
// Import the bugdoc and export as PDF.
loadFromFile(u"6m-wide.odg");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has 1 page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -805,7 +817,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageResourceInlineXObjectRef)
save(TestFilter::PDF_WRITER);
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Make sure that the page -> form -> form has a child image.
@@ -854,7 +867,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testDefaultVersion)
save(TestFilter::PDF_WRITER);
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
int nFileVersion = pPdfDocument->getFileVersion();
CPPUNIT_ASSERT_EQUAL(17, nFileVersion);
}
@@ -872,7 +886,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testVersion15)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
int nFileVersion = pPdfDocument->getFileVersion();
CPPUNIT_ASSERT_EQUAL(15, nFileVersion);
}
@@ -968,7 +983,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testVersion20)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
int nFileVersion = pPdfDocument->getFileVersion();
CPPUNIT_ASSERT_EQUAL(20, nFileVersion);
}
@@ -1133,7 +1149,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormFontName)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -4590,7 +4607,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageRotate180)
save(TestFilter::PDF_WRITER);
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
// Make sure that the page -> form -> form has a child image.
@@ -4632,7 +4650,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf144222)
#ifdef _WIN32
loadFromFile(u"tdf144222.ods");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -4673,7 +4692,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf145873)
loadFromFile(u"tdf145873.pptx");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -4709,7 +4729,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageHyperlink)
save(TestFilter::PDF_WRITER);
// Then make sure that link is preserved:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
// Without the accompanying fix in place, this test would have failed, the hyperlink of the PDF
@@ -4888,7 +4909,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageAnnots)
save(TestFilter::PDF_WRITER);
// Then make sure only the hyperlink is kept, since Draw itself has its own comments:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
// Without the accompanying fix in place, this test would have failed with:
@@ -4919,7 +4941,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageEncryption)
save(TestFilter::PDF_WRITER, /*rParams*/ {}, /*pPassword*/ "secret");
// Then make sure that the image is not lost:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"_ostr);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr);
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -4947,7 +4970,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testBitmapScaledown)
save(TestFilter::PDF_WRITER);
// Then verify that the bitmap is not downscaled:
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -4975,7 +4999,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf139627)
#if HAVE_MORE_FONTS
loadFromFile(u"justified-arabic-kashida.odt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -5372,7 +5397,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTrueTypeCompositeFont)
CPPUNIT_ASSERT(pDescriptor->Lookup("FontFile2"_ostr));
// and the text can still be extracted
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -5541,7 +5567,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf171869)
!= std::string::npos);
// Check the text can be extracted (i.e. the ToUnicode CMap works)
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT(pPdfPage);
@@ -5563,7 +5590,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf48707_1)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -5594,7 +5622,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf48707_2)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -5625,7 +5654,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf156528)
{
loadFromFile(u"wide_page1.fodt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// The document has two pages
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
@@ -5693,7 +5723,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf113866)
save(TestFilter::PDF_WRITER);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// Non-NULL pPdfDocument means pdfium is available.
if (pPdfDocument != nullptr)
@@ -5728,7 +5759,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159817)
loadFromFile(u"tdf159817.fodt");
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
@@ -5805,7 +5837,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf61444)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(4), aText.size());
@@ -5829,7 +5862,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf124116TrackUntrack)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
// The underlying document has 4 lines:
// - שמחַ plain
@@ -5862,7 +5896,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf134226)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(8), aText.size());
@@ -5896,7 +5931,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf71956)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(12), aText.size());
@@ -5933,7 +5969,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf101686)
{
loadFromFile(u"tdf101686.fodt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -6037,7 +6074,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157390)
loadFromFile(u"tdf157390-overlapping-kanji.fodt");
save(TestFilter::PDF_WRITER);
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
auto pPdfPage = pPdfDocument->openPage(/*nIndex*/ 0);
@@ -6093,7 +6130,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf162205Ltr)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(10), aText.size());
@@ -6126,7 +6164,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf162205Rtl)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(10), aText.size());
@@ -6159,7 +6198,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf162194SoftHyphen)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(4), aText.size());
@@ -6177,7 +6217,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf160786)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(5), aText.size());
@@ -6204,7 +6245,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf151748KashidaSpace)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(17), aText.size());
@@ -6242,7 +6284,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf163105SwKashidaSpaceExpansion)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(5), aText.size());
@@ -6264,7 +6307,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf163105Writer)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
// The fix allows kashida justification in this document.
// Without the fix, this will be 1.
@@ -6288,7 +6332,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf163105Editeng)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
// The fix allows kashida justification in this document.
// Without the fix, this will be 1.
@@ -6310,7 +6355,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf140767SyriacJustification)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(11), aText.size());
@@ -6337,7 +6383,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(16), aText.size());
@@ -6387,7 +6434,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf163913LeftRightMarginEm)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(9), aText.size());
@@ -6433,7 +6481,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormRoundtrip)
save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList());
// Parse the round-tripped document with PDFium
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get());
// Should be 1 page
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
@@ -6479,7 +6527,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf162750SmallCapsLigature)
loadFromFile(u"tdf162750.fodt");
save(TestFilter::PDF_WRITER);
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
auto pPdfPage = pPdfDocument->openPage(/*nIndex*/ 0);
@@ -6518,7 +6566,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf164106SplitReorderedClusters)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(14), aText.size());
@@ -6554,7 +6603,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPDFAttachmentsWithEncryptedFile)
/*pPassword*/ "secret");
// Parse the round-tripped document with PDFium
auto pPdfDocument = parsePDFExport("secret"_ostr);
auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr);
// Should be 1 page
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -6614,7 +6663,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTextBoxRuby)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(17), aText.size());
@@ -6676,7 +6726,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf166044ContFootnoteOnlyOnePgNum)
loadFromFile(u"tdf166044-cont-footnote-one-pgnum.fodt");
save(TestFilter::PDF_WRITER);
auto pPdfDocument = parsePDFExport();
auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount());
auto pPdfPage = pPdfDocument->openPage(0);
@@ -6709,7 +6759,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf118350StartEndParaAlign)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(24), aText.size());
@@ -6779,7 +6830,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf72640LabelAlignIgnoresDirOff)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*page*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*page*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(10), aText.size());
@@ -6809,7 +6861,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf72640LabelAlignIgnoresDirOn)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*page*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*page*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(10), aText.size());
@@ -6838,7 +6891,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, tdf150076BackgroundPdf)
save(TestFilter::PDF_WRITER);
// Parse the export result.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(0);
CPPUNIT_ASSERT(pPdfPage);
@@ -6857,7 +6911,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf155557UnderlineKashidaPortion)
loadFromFile(u"tdf155557-underline-kashida-portion.fodt");
save(TestFilter::PDF_WRITER);
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
= parsePDFExport(vcl::pdf::PDFiumLibrary::get());
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
@@ -6898,7 +6953,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf117941RtlStrikeoutChars)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*page*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*page*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(8), aText.size());
@@ -6935,7 +6991,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testDropCapPaint)
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
GetPdfPageTextObjectsAndBounds(parsePDFExport(), /*nPage*/ 0, aText, aRect);
GetPdfPageTextObjectsAndBounds(parsePDFExport(vcl::pdf::PDFiumLibrary::get()), /*nPage*/ 0,
aText, aRect);
CPPUNIT_ASSERT_EQUAL(size_t(7), aText.size());
+1 -1
View File
@@ -802,7 +802,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature)
pObjectShell->SignDocumentContentUsingCertificate(aSigningContext);
// Then: count the # of shapes on the signature widget/annotation.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(pPDFium);
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount());