include/test/unoapi_test.hxx             |    2 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |  321 +++++++++++++++++++++++--------
 writerperfect/qa/unit/EPUBExportTest.cxx |  240 ++++++++++++++---------
 3 files changed, 396 insertions(+), 167 deletions(-)

New commits:
commit 16f1f5248bbc1b4e7b413dd194774b95eabb8809
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Feb 3 16:21:45 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Feb 3 21:05:34 2026 +0100

    CppunitTest_vcl_pdfexport: only use aMediaDescriptor where needed
    
    Change-Id: I60bf6754e7b221ec38618edd69dc3ad309f6a8e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198612
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 3641f182e72d..786b65d80813 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -39,18 +39,12 @@ namespace
 /// Tests the PDF export filter.
 class PdfExportTest : public UnoApiTest
 {
-protected:
-    comphelper::SequenceAsHashMap aMediaDescriptor;
-
 public:
     PdfExportTest()
         : UnoApiTest(u"/vcl/qa/cppunit/pdfexport/data/"_ustr)
     {
     }
 
-    void saveAsPDF(std::u16string_view rFile);
-    void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument);
-
 #if !defined MACOSX && !defined _WIN32
     std::unique_ptr<vcl::pdf::PDFiumDocument> parsePDFExportNoAssert()
     {
@@ -65,29 +59,15 @@ public:
 #endif
 };
 
-void PdfExportTest::saveAsPDF(std::u16string_view rFile)
-{
-    // Import the bugdoc and export as PDF.
-    loadFromFile(rFile);
-    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
-}
-
-void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& 
rDocument)
-{
-    saveAsPDF(rFile);
-
-    // Parse the export result.
-    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
-    CPPUNIT_ASSERT(rDocument.Read(aStream));
-}
-
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testPopupRectangleSize)
 {
     // Enable Comment as PDF annotations
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "ExportNotes", uno::Any(true) } 
}));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf162955_comment.odp");
+    loadFromFile(u"tdf162955_comment.odp");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -116,10 +96,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160051)
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
},
                                            { "SelectPdfVersion", 
uno::Any(sal_Int32(17)) } }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf160051.odt", aDocument);
+    loadFromFile(u"tdf160051.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size());
@@ -156,10 +142,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testCommentAnnotation)
     // Enable PDF/UA and Comment as PDF annotations
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence(
         { { "PDFUACompliance", uno::Any(true) }, { "ExportNotes", 
uno::Any(true) } }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf162359.odt", aDocument);
+    loadFromFile(u"tdf162359.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -216,7 +208,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testCommentAnnotation)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testFigurePlacement)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf159900_figurePlacement.odt", aDocument);
+    loadFromFile(u"tdf159900_figurePlacement.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -261,10 +258,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059)
     // Explicitly enable the usage of the reference XObject markup.
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "UseReferenceXObject", 
uno::Any(true) } }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf106059.odt", aDocument);
+    loadFromFile(u"tdf106059.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Assert that the XObject in the page resources dictionary is a reference 
XObject.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -289,7 +292,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf106693.odt", aDocument);
+    loadFromFile(u"tdf106693.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Assert that the XObject in the page resources dictionary is a form 
XObject.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -335,7 +343,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105461)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf105461.odp");
+    loadFromFile(u"tdf105461.odp");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -411,7 +420,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107868)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf105093.odp", aDocument);
+    loadFromFile(u"tdf105093.odp");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -452,7 +466,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206)
 {
     // Import the bugdoc and export as PDF.
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf106206.odt", aDocument);
+    loadFromFile(u"tdf106206.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -493,8 +512,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf127217.odt");
+    loadFromFile(u"tdf127217.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -518,8 +539,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142741)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf142741.odt");
+    loadFromFile(u"tdf142741.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -548,7 +571,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143)
 {
     // Import the bugdoc and export as PDF.
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf109143.odt", aDocument);
+    loadFromFile(u"tdf109143.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -578,7 +606,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972)
 {
     // Import the bugdoc and export as PDF.
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf106972.odt", aDocument);
+    loadFromFile(u"tdf106972.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Get access to the only form object on the only page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -617,7 +650,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17)
 {
     // Import the bugdoc and export as PDF.
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf106972-pdf17.odt", aDocument);
+    loadFromFile(u"tdf106972-pdf17.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Get access to the only image on the only page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -687,7 +725,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testSofthyphenPos)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf107013.odt", aDocument);
+    loadFromFile(u"tdf107013.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Get access to the only image on the only page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -707,7 +750,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf107018.odt", aDocument);
+    loadFromFile(u"tdf107018.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Get access to the only image on the only page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -766,8 +814,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf148706.odt");
+    loadFromFile(u"tdf148706.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -800,7 +850,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf107089.odt", aDocument);
+    loadFromFile(u"tdf107089.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // Get access to the only image on the only page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -847,7 +902,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf99680.odt", aDocument);
+    loadFromFile(u"tdf99680.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -888,7 +948,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680_2)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf99680-2.odt", aDocument);
+    loadFromFile(u"tdf99680-2.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // For each document page
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -931,7 +996,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680_2)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf108963)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf108963.odp");
+    loadFromFile(u"tdf108963.odp");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1008,7 +1074,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf108963)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"alternativeText.fodp", aDocument);
+    loadFromFile(u"alternativeText.fodp");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -1049,9 +1120,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf105972.fodt", aDocument);
+    loadFromFile(u"tdf105972.fodt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -1117,10 +1194,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf148442.odt", aDocument);
+    loadFromFile(u"tdf148442.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -1191,10 +1274,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, 
testTdf118244_radioButtonGroup)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
         { "ExportFormFields", uno::Any(true) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf118244_radioButtonGroup.odt", aDocument);
+    loadFromFile(u"tdf118244_radioButtonGroup.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -1236,7 +1325,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1)
 {
 #if HAVE_MORE_FONTS
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf115117-1.odt", aDocument);
+    loadFromFile(u"tdf115117-1.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     vcl::filter::PDFObjectElement* pToUnicode = nullptr;
 
@@ -1303,7 +1397,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2)
     // See the comments in testTdf115117_1() for explanation.
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf115117-2.odt", aDocument);
+    loadFromFile(u"tdf115117-2.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     vcl::filter::PDFObjectElement* pToUnicode = nullptr;
 
@@ -1354,7 +1453,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1a)
 {
 #if HAVE_MORE_FONTS
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf115117-1.odt");
+    loadFromFile(u"tdf115117-1.odt");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1388,7 +1488,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2a)
     // See the comments in testTdf115117_1a() for explanation.
 
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf115117-2.odt");
+    loadFromFile(u"tdf115117-2.odt");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1417,7 +1518,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf154549)
 {
 // FIXME: On Windows, the number of chars is 4 instead of 3
 #ifndef _WIN32
-    saveAsPDF(u"tdf154549.odt");
+    loadFromFile(u"tdf154549.odt");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1449,7 +1551,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf150846)
 {
     // Without the fix in place, this test would have failed with
     // An uncaught exception of type com.sun.star.io.IOException
-    saveAsPDF(u"tdf150846.txt");
+    loadFromFile(u"tdf150846.txt");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1474,7 +1577,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf150846)
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160401)
 {
-    saveAsPDF(u"tdf160401.pptx");
+    loadFromFile(u"tdf160401.pptx");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1506,7 +1610,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160401)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf103492)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf103492.odt");
+    loadFromFile(u"tdf103492.odt");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1552,7 +1657,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf103492)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf145274)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf145274.docx");
+    loadFromFile(u"tdf145274.docx");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1586,7 +1692,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf145274)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf156685)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf156685.docx");
+    loadFromFile(u"tdf156685.docx");
+    save(TestFilter::PDF_WRITER);
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1624,7 +1731,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 #if HAVE_MORE_FONTS
     // This requires Amiri font, if it is missing the test will fail.
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf66597-1.odt", aDocument);
+    loadFromFile(u"tdf66597-1.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     {
         // Get access to ToUnicode of the first font
@@ -1720,7 +1832,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2)
 {
 #if HAVE_MORE_FONTS
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf66597-2.odt", aDocument);
+    loadFromFile(u"tdf66597-2.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     {
         // Get access to ToUnicode of the first font
@@ -1835,7 +1952,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3)
 {
 #if HAVE_MORE_FONTS
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf66597-3.odt", aDocument);
+    loadFromFile(u"tdf66597-3.odt");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     {
         // Get access to ToUnicode of the first font
@@ -1923,8 +2045,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105954)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence(
         { { "ReduceImageResolution", uno::Any(true) },
           { "MaxImageResolution", uno::Any(static_cast<sal_Int32>(300)) } }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf105954.odt");
+    loadFromFile(u"tdf105954.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
@@ -1949,7 +2073,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105954)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157679)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf157679.pptx");
+    loadFromFile(u"tdf157679.pptx");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
 
     // The document has one page.
@@ -1976,7 +2101,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157679)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf128445)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf128445.odp");
+    loadFromFile(u"tdf128445.odp");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
 
     // The document has one page.
@@ -1999,7 +2125,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf128630)
         return;
 
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf128630.odp");
+    loadFromFile(u"tdf128630.odp");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
 
     // The document has one page.
@@ -2031,7 +2158,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf128630)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106702)
 {
     // Import the bugdoc and export as PDF.
-    saveAsPDF(u"tdf106702.odt");
+    loadFromFile(u"tdf106702.odt");
+    save(TestFilter::PDF_WRITER);
 
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
 
@@ -2085,8 +2213,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143)
         // Set a custom PDF version.
         { "SelectPdfVersion", uno::Any(static_cast<sal_Int32>(16)) },
     }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf113143.odp");
+    loadFromFile(u"tdf113143.odp");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
 
@@ -2143,30 +2273,35 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testForcePoint71)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testForcePoint80)
 {
     // printing asserted in SwCellFrame::FindStartEndOfRowSpanCell
-    saveAsPDF(u"forcepoint80-1.rtf");
+    loadFromFile(u"forcepoint80-1.rtf");
+    save(TestFilter::PDF_WRITER);
 }
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testForcePoint3)
 {
     // printing asserted in SwFrame::GetNextSctLeaf()
-    saveAsPDF(u"flowframe_null_ptr_deref.sample");
+    loadFromFile(u"flowframe_null_ptr_deref.sample");
+    save(TestFilter::PDF_WRITER);
 }
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf162586)
 {
     // Without the fix in place, this test would have crashed
-    saveAsPDF(u"tdf162586.odt");
+    loadFromFile(u"tdf162586.odt");
+    save(TestFilter::PDF_WRITER);
 }
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf84283)
 {
     // Without the fix in place, this test would have crashed
-    saveAsPDF(u"tdf84283.doc");
+    loadFromFile(u"tdf84283.doc");
+    save(TestFilter::PDF_WRITER);
 }
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115262)
 {
-    saveAsPDF(u"tdf115262.ods");
+    loadFromFile(u"tdf115262.ods");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
     CPPUNIT_ASSERT_EQUAL(8, pPdfDocument->getPageCount());
 
@@ -2204,7 +2339,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115262)
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf121962)
 {
-    saveAsPDF(u"tdf121962.odt");
+    loadFromFile(u"tdf121962.odt");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
     CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
 
@@ -2227,7 +2363,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf121962)
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139065)
 {
-    saveAsPDF(u"tdf139065.odt");
+    loadFromFile(u"tdf139065.odt");
+    save(TestFilter::PDF_WRITER);
     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);
@@ -2244,10 +2381,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
     // Enable PDF/UA
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf157816.fodt", aDocument);
+    loadFromFile(u"tdf157816.fodt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -2640,10 +2783,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link)
     // Enable PDF/UA
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"LinkWithFly.fodt", aDocument);
+    loadFromFile(u"LinkWithFly.fodt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -2983,7 +3132,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link)
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142133)
 {
     vcl::filter::PDFDocument aDocument;
-    load(u"tdf142133.docx", aDocument);
+    loadFromFile(u"tdf142133.docx");
+    save(TestFilter::PDF_WRITER);
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -3020,10 +3174,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142806)
     // Enable PDF/UA
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
 
     vcl::filter::PDFDocument aDocument;
-    load(u"LinkPages.fodt", aDocument);
+    loadFromFile(u"LinkPages.fodt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
+
+    // Parse the export result.
+    SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+    CPPUNIT_ASSERT(aDocument.Read(aStream));
 
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), aPages.size());
@@ -3620,7 +3780,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142806)
 
 CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115967)
 {
-    saveAsPDF(u"tdf115967.odt");
+    loadFromFile(u"tdf115967.odt");
+    save(TestFilter::PDF_WRITER);
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
     CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
 
@@ -3649,8 +3810,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf167659)
     // Don't export showing tracked changes to PDF
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "ExportTrackedChanges", 
uno::Any(false) } }));
+    comphelper::SequenceAsHashMap aMediaDescriptor;
     aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
-    saveAsPDF(u"tdf167659.odt");
+    loadFromFile(u"tdf167659.odt");
+    save(TestFilter::PDF_WRITER, 
aMediaDescriptor.getAsConstPropertyValueList());
 
     // Parse the export result with pdfium.
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
commit 79028582a9e2cb55a3b0f51d7c41b020189bb4d5
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Feb 3 17:31:44 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Feb 3 21:05:22 2026 +0100

    CppunitTest_writerperfect_epubexport: use UnoApiTest::save
    
    and drop member variables. They are used only in some tests
    
    Change-Id: I061bb20c3e7d515affa7d00aad9410a0418dbc84
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198618
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins

diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index 6e21933395a0..6f7208b488f8 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -39,6 +39,7 @@ enum class TestFilter
     DOCX,
     DOCX_2007,
     DOTX,
+    EPUB,
     FODG,
     FODS,
     FODT,
@@ -85,6 +86,7 @@ const std::unordered_map<TestFilter, OUString> 
TestFilterNames{
     { TestFilter::DOCX, u"Office Open XML Text"_ustr },
     { TestFilter::DOCX_2007, u"MS Word 2007 XML"_ustr },
     { TestFilter::DOTX, u"MS Word 2007 XML Template"_ustr },
+    { TestFilter::EPUB, u"EPUB"_ustr },
     { TestFilter::FODG, u"OpenDocument Drawing Flat XML"_ustr },
     { TestFilter::FODS, u"OpenDocument Spreadsheet Flat XML"_ustr },
     { TestFilter::FODT, u"OpenDocument Text Flat XML"_ustr },
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx 
b/writerperfect/qa/unit/EPUBExportTest.cxx
index 4f502a1bf614..e9b2bee21cc9 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
 
 #include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/string.hxx>
 #include <o3tl/safeint.hxx>
@@ -39,9 +40,6 @@ namespace
 class EPUBExportTest : public UnoApiXmlTest
 {
 protected:
-    uno::Reference<packages::zip::XZipFileAccess2> mxZipFile;
-    OUString maFilterOptions;
-
 public:
     EPUBExportTest()
         : UnoApiXmlTest(u"/writerperfect/qa/unit/data/writer/epubexport/"_ustr)
@@ -49,8 +47,6 @@ public:
     }
 
     void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
-    void createDoc(std::u16string_view rFile,
-                   const uno::Sequence<beans::PropertyValue>& rFilterData);
     /// Parses a CSS representation of the stream named rName and returns it.
     std::map<OUString, std::vector<OUString>> parseCss(const OUString& rName);
     /// Looks up a key of a class in rCss.
@@ -66,27 +62,13 @@ void EPUBExportTest::registerNamespaces(xmlXPathContextPtr& 
pXmlXpathCtx)
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("svg"), 
BAD_CAST("http://www.w3.org/2000/svg";));
 }
 
-void EPUBExportTest::createDoc(std::u16string_view rFile,
-                               const uno::Sequence<beans::PropertyValue>& 
rFilterData)
-{
-    // Import the bugdoc and export as EPUB.
-    loadFromFile(rFile);
-    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-    comphelper::SequenceAsHashMap aMediaDescriptor;
-    aMediaDescriptor[u"FilterName"_ustr] <<= u"EPUB"_ustr;
-    if (maFilterOptions.isEmpty())
-        aMediaDescriptor[u"FilterData"_ustr] <<= rFilterData;
-    else
-        aMediaDescriptor[u"FilterOptions"_ustr] <<= maFilterOptions;
-    xStorable->storeToURL(maTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
-    mxZipFile = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
-}
-
 std::map<OUString, std::vector<OUString>> EPUBExportTest::parseCss(const 
OUString& rName)
 {
     std::map<OUString, std::vector<OUString>> aRet;
 
-    uno::Reference<io::XInputStream> xInputStream(mxZipFile->getByName(rName), 
uno::UNO_QUERY);
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    uno::Reference<io::XInputStream> xInputStream(xZipFile->getByName(rName), 
uno::UNO_QUERY);
     std::unique_ptr<SvStream> 
pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
 
     // Minimal CSS handler till orcus is up to our needs.
@@ -133,18 +115,22 @@ OUString EPUBExportTest::getCss(std::map<OUString, 
std::vector<OUString>>& rCss,
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testOutlineLevel)
 {
-    createDoc(u"outline-level.fodt", {});
+    loadFromFile(u"outline-level.fodt");
+    save(TestFilter::EPUB);
 
     // Make sure that the output is split into two.
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
     // This failed, output was a single section.
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
-    
CPPUNIT_ASSERT(!mxZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
+    
CPPUNIT_ASSERT(!xZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
 }
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMimetype)
 {
-    createDoc(u"hello.fodt", {});
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB);
 
     // Check that the mime type is written uncompressed at the expected 
location.
     SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
@@ -183,7 +169,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEPUB2)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence(
         { // Explicitly request EPUB2.
           { "EPUBVersion", uno::Any(static_cast<sal_Int32>(20)) } }));
-    createDoc(u"hello.fodt", aFilterData);
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
 
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
     // This was 3.0, EPUBVersion filter option was ignored and we always 
emitted EPUB3.
@@ -196,7 +185,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEPUBFixedLayout)
         { // Explicitly request fixed layout.
           { "EPUBLayoutMethod",
             
uno::Any(static_cast<sal_Int32>(libepubgen::EPUB_LAYOUT_METHOD_FIXED)) } }));
-    createDoc(u"hello.fodt", aFilterData);
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
 
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
     // This was missing, EPUBLayoutMethod filter option was ignored and we 
always emitted reflowable layout.
@@ -207,8 +199,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEPUBFixedLayout)
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEPUBFixedLayoutOption)
 {
     // Explicitly request fixed layout, this time via FilterOptions.
-    maFilterOptions = "layout=fixed";
-    createDoc(u"hello.fodt", {});
+    comphelper::SequenceAsHashMap aMediaDescriptor;
+    aMediaDescriptor[u"FilterOptions"_ustr] <<= u"layout=fixed"_ustr;
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, aMediaDescriptor.getAsConstPropertyValueList());
 
     // This failed, fixed layout was only working via the FilterData map.
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
@@ -222,12 +216,17 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testEPUBFixedLayoutImplicitBreak)
         { // Explicitly request fixed layout.
           { "EPUBLayoutMethod",
             
uno::Any(static_cast<sal_Int32>(libepubgen::EPUB_LAYOUT_METHOD_FIXED)) } }));
-    createDoc(u"fxl-2page.fodt", aFilterData);
-
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
+    loadFromFile(u"fxl-2page.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
+
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
     // This was missing, implicit page break (as calculated by the layout) was 
lost on export.
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
-    
CPPUNIT_ASSERT(!mxZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
+    
CPPUNIT_ASSERT(!xZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
 
     // Make sure that fixed layout has chapter names in the navigation
     // document.
@@ -243,18 +242,24 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPageBreakSplit)
         { // Explicitly request split on page break (instead of on heading).
           { "EPUBSplitMethod",
             
uno::Any(static_cast<sal_Int32>(libepubgen::EPUB_SPLIT_METHOD_PAGE_BREAK)) } 
}));
-    createDoc(u"2pages.fodt", aFilterData);
+    loadFromFile(u"2pages.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
 
     // Make sure that the output is split into two.
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0001.xhtml"_ustr));
     // This failed, output was a single section.
-    
CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
-    
CPPUNIT_ASSERT(!mxZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
+    
CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/sections/section0002.xhtml"_ustr));
+    
CPPUNIT_ASSERT(!xZipFile->hasByName(u"OEBPS/sections/section0003.xhtml"_ustr));
 }
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSpanAutostyle)
 {
-    createDoc(u"span-autostyle.fodt", {});
+    loadFromFile(u"span-autostyle.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPath(mpXmlDoc, "//xhtml:p/xhtml:span[1]", "class", u"span0");
@@ -266,7 +271,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSpanAutostyle)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testParaAutostyleCharProps)
 {
-    createDoc(u"para-autostyle-char-props.fodt", {});
+    loadFromFile(u"para-autostyle-char-props.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This failed, para-level char props were not exported.
@@ -276,7 +282,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testParaAutostyleCharProps)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMeta)
 {
-    createDoc(u"meta.fodt", {});
+    loadFromFile(u"meta.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
     // This was "Unknown Author", <meta:initial-creator> was not handled.
@@ -291,12 +298,15 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMeta)
                 "properties", u"cover-image");
     assertXPath(mpXmlDoc, 
"/opf:package/opf:manifest/opf:item[@href='images/image0001.png']",
                 "media-type", u"image/png");
-    CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/images/image0001.png"_ustr));
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/images/image0001.png"_ustr));
 }
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMetaXMP)
 {
-    createDoc(u"meta-xmp.fodt", {});
+    loadFromFile(u"meta-xmp.fodt");
+    save(TestFilter::EPUB);
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
 
     // These were the libepubgen default values, metadata from a matching .xmp 
file was not picked up.
@@ -318,7 +328,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMetaAPI)
           { "RVNGInitialCreator", uno::Any(u"unknown author from api"_ustr) },
           { "RVNGLanguage", uno::Any(u"hu"_ustr) },
           { "RVNGDate", uno::Any(u"2015-11-20T17:16:07Z"_ustr) } }));
-    createDoc(u"meta-xmp.fodt", aFilterData);
+    loadFromFile(u"meta-xmp.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
 
     // These were values from XMP (deadbeef, etc.), not from API.
@@ -337,7 +350,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testCoverImage)
     OUString aCoverURL = createFileURL(u"meta.cover-image.png");
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "RVNGCoverImage", 
uno::Any(aCoverURL) } }));
-    createDoc(u"hello.fodt", aFilterData);
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
     xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/content.opf"_ustr);
 
     // Make sure that the explicitly set cover image is used.
@@ -346,12 +362,15 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testCoverImage)
                 "properties", u"cover-image");
     assertXPath(mpXmlDoc, 
"/opf:package/opf:manifest/opf:item[@href='images/image0001.png']",
                 "media-type", u"image/png");
-    CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/images/image0001.png"_ustr));
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/images/image0001.png"_ustr));
 }
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testParaNamedstyle)
 {
-    createDoc(u"para-namedstyle.fodt", {});
+    loadFromFile(u"para-namedstyle.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPath(mpXmlDoc, "//xhtml:p[1]", "class", u"para0");
@@ -366,7 +385,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testParaNamedstyle)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testCharNamedstyle)
 {
-    createDoc(u"char-namedstyle.fodt", {});
+    loadFromFile(u"char-namedstyle.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
 
@@ -378,7 +398,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testCharNamedstyle)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testNamedStyleInheritance)
 {
-    createDoc(u"named-style-inheritance.fodt", {});
+    loadFromFile(u"named-style-inheritance.fodt");
+    save(TestFilter::EPUB);
 
     // Find the CSS rule for the blue text.
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
@@ -395,7 +416,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testNamedStyleInheritance)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testNestedSpan)
 {
-    createDoc(u"nested-span.fodt", {});
+    loadFromFile(u"nested-span.fodt");
+    save(TestFilter::EPUB);
 
     // Check textural content of nested span.
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
@@ -414,7 +436,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testNestedSpan)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLineBreak)
 {
-    createDoc(u"line-break.fodt", {});
+    loadFromFile(u"line-break.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This was 0, line break was not handled.
@@ -425,7 +448,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLineBreak)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEscape)
 {
-    createDoc(u"escape.fodt", {});
+    loadFromFile(u"escape.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This was lost.
@@ -441,7 +465,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testEscape)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testParaCharProps)
 {
-    createDoc(u"para-char-props.fodt", {});
+    loadFromFile(u"para-char-props.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -456,7 +481,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testParaCharProps)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSection)
 {
-    createDoc(u"section.fodt", {});
+    loadFromFile(u"section.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This was "After.", i.e. in-section content was ignored.
@@ -465,7 +491,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSection)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testList)
 {
-    createDoc(u"list.fodt", {});
+    loadFromFile(u"list.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This was "C", i.e. in-list content was ignored.
@@ -476,7 +503,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testList)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImage)
 {
-    createDoc(u"image.fodt", {});
+    loadFromFile(u"image.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPath(mpXmlDoc, "//xhtml:p/xhtml:img", 1);
@@ -484,7 +512,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImage)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageBorder)
 {
-    createDoc(u"image-border.fodt", {});
+    loadFromFile(u"image-border.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -498,7 +527,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageBorder)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageNospan)
 {
-    createDoc(u"image-nospan.fodt", {});
+    loadFromFile(u"image-nospan.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // Image outside a span was lost.
@@ -507,7 +537,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageNospan)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTable)
 {
-    createDoc(u"table.fodt", {});
+    loadFromFile(u"table.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPath(mpXmlDoc, "//xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td", 4);
@@ -515,7 +546,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTable)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableRowSpan)
 {
-    createDoc(u"table-row-span.fodt", {});
+    loadFromFile(u"table-row-span.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This failed, row span wasn't exported.
@@ -524,7 +556,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableRowSpan)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableCellBorder)
 {
-    createDoc(u"table-cell-border.fodt", {});
+    loadFromFile(u"table-cell-border.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -539,7 +572,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableCellBorder)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableCellWidth)
 {
-    createDoc(u"table-cell-width.fodt", {});
+    loadFromFile(u"table-cell-width.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -559,7 +593,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableCellWidth)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableRowHeight)
 {
-    createDoc(u"table-row-height.fodt", {});
+    loadFromFile(u"table-row-height.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -573,7 +608,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableRowHeight)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLink)
 {
-    createDoc(u"link.fodt", {});
+    loadFromFile(u"link.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPathContent(mpXmlDoc, "//xhtml:p/xhtml:a/xhtml:span", 
u"https://libreoffice.org/";);
@@ -582,7 +618,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLink)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLinkInvalid)
 {
-    createDoc(u"link-invalid.odt", {});
+    loadFromFile(u"link-invalid.odt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This was 1, invalid relative link was not filtered out.
@@ -591,7 +628,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLinkInvalid)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLinkCharFormat)
 {
-    createDoc(u"link-charformat.fodt", {});
+    loadFromFile(u"link-charformat.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // <span> was lost, link text having a char format was missing.
@@ -602,7 +640,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLinkCharFormat)
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testLinkNamedCharFormat)
 {
     // Character properties from named character style on hyperlink was lost.
-    createDoc(u"link-namedcharformat.fodt", {});
+    loadFromFile(u"link-namedcharformat.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -617,7 +656,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testLinkNamedCharFormat)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableWidth)
 {
-    createDoc(u"table-width.fodt", {});
+    loadFromFile(u"table-width.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -630,7 +670,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTableWidth)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTextBox)
 {
-    createDoc(u"text-box.fodt", {});
+    loadFromFile(u"text-box.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     std::map<OUString, std::vector<OUString>> aCssDoc
@@ -652,7 +693,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTextBox)
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testFontEmbedding)
 {
 #if !defined(MACOSX)
-    createDoc(u"font-embedding.fodt", {});
+    loadFromFile(u"font-embedding.fodt");
+    save(TestFilter::EPUB);
 
     // Make sure that the params of defineEmbeddedFont() are all handled.
     // librevenge:name
@@ -666,7 +708,9 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testFontEmbedding)
     assertXPath(mpXmlDoc, 
"/opf:package/opf:manifest/opf:item[@href='fonts/font0001.otf']",
                 "media-type", u"application/vnd.ms-opentype");
     // office:binary-data
-    CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/fonts/font0001.otf"_ustr));
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/fonts/font0001.otf"_ustr));
     // librevenge:font-style
     CPPUNIT_ASSERT_EQUAL(u"normal"_ustr,
                          EPUBExportTest::getCss(aCssDoc, u"font-face"_ustr, 
u"font-style"));
@@ -678,7 +722,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testFontEmbedding)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageLink)
 {
-    createDoc(u"image-link.fodt", {});
+    loadFromFile(u"image-link.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // This failed, image was missing.
@@ -687,7 +732,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImageLink)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testFootnote)
 {
-    createDoc(u"footnote.fodt", {});
+    loadFromFile(u"footnote.fodt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // These were missing, footnote was lost.
@@ -697,7 +743,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testFootnote)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPopup)
 {
-    createDoc(u"popup.odt", {});
+    loadFromFile(u"popup.odt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // Test image popup anchor.
@@ -719,7 +766,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPopupMedia)
 {
     // This is the same as testPopup(), but the links point to images in the
     // default media directory, not in the document directory.
-    createDoc(u"popup-media.odt", {});
+    loadFromFile(u"popup-media.odt");
+    save(TestFilter::EPUB);
 
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     // Test image popup anchor. This failed, number of XPath nodes was 0.
@@ -733,7 +781,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPopupAPI)
     OUString aMediaDir = createFileURL(u"popup");
     uno::Sequence<beans::PropertyValue> aFilterData(
         comphelper::InitPropertySequence({ { "RVNGMediaDir", 
uno::Any(aMediaDir) } }));
-    createDoc(u"popup-api.odt", aFilterData);
+    loadFromFile(u"popup-api.odt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
 
     // We have a non-empty anchor image.
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
@@ -751,7 +802,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPageSize)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence(
         { { "EPUBLayoutMethod",
             
uno::Any(static_cast<sal_Int32>(libepubgen::EPUB_LAYOUT_METHOD_FIXED)) } }));
-    createDoc(u"hello.fodt", aFilterData);
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
 
     // This failed, viewport was empty, so page size was lost.
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
@@ -770,11 +824,16 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSVG)
     uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence(
         { { "EPUBLayoutMethod",
             
uno::Any(static_cast<sal_Int32>(libepubgen::EPUB_LAYOUT_METHOD_FIXED)) } }));
-    createDoc(u"hello.fodt", aFilterData);
-
-    CPPUNIT_ASSERT(mxZipFile->hasByName(u"OEBPS/images/image0001.svg"_ustr));
+    loadFromFile(u"hello.fodt");
+    save(TestFilter::EPUB, {
+                               
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
+                           });
+
+    uno::Reference<packages::zip::XZipFileAccess2> xZipFile
+        = packages::zip::ZipFileAccess::createWithURL(m_xContext, 
maTempFile.GetURL());
+    CPPUNIT_ASSERT(xZipFile->hasByName(u"OEBPS/images/image0001.svg"_ustr));
     uno::Reference<io::XInputStream> xInputStream(
-        mxZipFile->getByName(u"OEBPS/images/image0001.svg"_ustr), 
uno::UNO_QUERY);
+        xZipFile->getByName(u"OEBPS/images/image0001.svg"_ustr), 
uno::UNO_QUERY);
     std::unique_ptr<SvStream> 
pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
 
     SvMemoryStream aMemoryStream;
@@ -796,7 +855,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSVG)
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTdf115623SingleWritingMode)
 {
     // Simple page that has single writing mode should work.
-    createDoc(u"tdf115623-single-writing-mode.odt", {});
+    loadFromFile(u"tdf115623-single-writing-mode.odt");
+    save(TestFilter::EPUB);
     std::map<OUString, std::vector<OUString>> aCssDoc
         = parseCss(u"OEBPS/styles/stylesheet.css"_ustr);
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
@@ -807,7 +867,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testTdf115623SingleWritingMode)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTdf115623SplitByChapter)
 {
-    createDoc(u"tdf115623-split-by-chapter.odt", {});
+    loadFromFile(u"tdf115623-split-by-chapter.odt");
+    save(TestFilter::EPUB);
     std::map<OUString, std::vector<OUString>> aCssDoc
         = parseCss(u"OEBPS/styles/stylesheet.css"_ustr);
     {
@@ -827,7 +888,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testTdf115623SplitByChapter)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTdf115623ManyPageSpans)
 {
-    createDoc(u"tdf115623-many-pagespans.odt", {});
+    loadFromFile(u"tdf115623-many-pagespans.odt");
+    save(TestFilter::EPUB);
     std::map<OUString, std::vector<OUString>> aCssDoc
         = parseCss(u"OEBPS/styles/stylesheet.css"_ustr);
     // Two pages should have different writing modes.
@@ -847,7 +909,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, 
testTdf115623ManyPageSpans)
 
 CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSimpleRuby)
 {
-    createDoc(u"simple-ruby.odt", {});
+    loadFromFile(u"simple-ruby.odt");
+    save(TestFilter::EPUB);
     xmlDocUniquePtr mpXmlDoc = 
parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
     assertXPathContent(mpXmlDoc, "//xhtml:body/xhtml:p/xhtml:ruby/xhtml:span", 
u"base text");
     assertXPathContent(mpXmlDoc, "//xhtml:body/xhtml:p/xhtml:ruby/xhtml:rt", 
u"ruby text");
@@ -857,7 +920,8 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testAbi11105)
 {
     // This crashed because the paragraph style "P5" which had a 
master-page-name
     // appeared in a table cell messed up page spans.
-    createDoc(u"abi11105.abw", {});
+    loadFromFile(u"abi11105.abw");
+    save(TestFilter::EPUB);
 }
 }
 

Reply via email to