add parsePDFExportNoAssert for the case of no cups support

Change-Id: Iba0288c4ac6b3dfaae0253224a19369974346485
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195454
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2025-12-12 14:49:15 +01:00
parent 37c5a752ee
commit e7e03e8869
+13 -2
View File
@@ -44,6 +44,17 @@ public:
void saveAsPDF(std::u16string_view rFile);
void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument);
std::unique_ptr<vcl::pdf::PDFiumDocument> parsePDFExportNoAssert()
{
SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
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());
}
};
void PdfExportTest::saveAsPDF(std::u16string_view rFile)
@@ -360,7 +371,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107868)
xPrintable->print(aOptions);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExportNoAssert();
if (!pPdfDocument)
// Printing to PDF failed in a non-interesting way, e.g. CUPS is not
// running, there is no printer defined, etc.
@@ -635,7 +646,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testSofthyphenPos)
xPrintable->print(aOptions);
// Parse the export result with pdfium.
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExportNoAssert();
if (!pPdfDocument)
// Printing to PDF failed in a non-interesting way, e.g. CUPS is not
// running, there is no printer defined, etc.