sd/qa/unit/data/pdf/textheight1.pdf |binary sd/qa/unit/export-tests.cxx | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)
New commits: commit 7590fde54ba912a6f4e781b7b00ac6417a7eab7f Author: Caolán McNamara <[email protected]> AuthorDate: Mon Sep 15 17:01:00 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Oct 2 15:44:57 2025 +0200 add test for vertical placement of exploded pdf Change-Id: I05c608a18e5b714a611bc986b88721521456b3d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190985 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191773 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/qa/unit/data/sample.pdf b/sd/qa/unit/data/pdf/sample.pdf similarity index 100% rename from sd/qa/unit/data/sample.pdf rename to sd/qa/unit/data/pdf/sample.pdf diff --git a/sd/qa/unit/data/pdf/textheight1.pdf b/sd/qa/unit/data/pdf/textheight1.pdf new file mode 100644 index 000000000000..b11b1f76e84f Binary files /dev/null and b/sd/qa/unit/data/pdf/textheight1.pdf differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 3442a0873142..4aacdf0fd87a 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -76,6 +76,20 @@ public: }; }; + xmlDocUniquePtr parseLayout() const + { + SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); + CPPUNIT_ASSERT(pModel); + SfxObjectShell* pShell = pModel->GetObjectShell(); + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + + xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + return pXmlDoc; + } + protected: uno::Reference<awt::XBitmap> getBitmapFromTable(OUString const& rName); }; @@ -1015,7 +1029,7 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdf) return; UsePdfium aGuard; - loadFromFile(u"sample.pdf"); + loadFromFile(u"pdf/sample.pdf"); setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}"); setImportFilterName(u"OpenDocument Drawing Flat XML"_ustr); @@ -1031,6 +1045,25 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdf) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), pObjGroup->GetObjCount()); } +CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfTextPos) +{ + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + if (!pPdfium) + return; + UsePdfium aGuard; + + loadFromFile(u"pdf/textheight1.pdf"); + + setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}"); + setImportFilterName(u"OpenDocument Drawing Flat XML"_ustr); + saveAndReload(u"OpenDocument Drawing Flat XML"_ustr); + + xmlDocUniquePtr pXml = parseLayout(); + sal_Int32 y = getXPath(pXml, "//textarray[1]", "y").toInt32(); + // was 3092 before + CPPUNIT_ASSERT_DOUBLES_EQUAL(3055, y, 0); +} + CPPUNIT_TEST_FIXTURE(SdExportTest, testEmbeddedText) { createSdDrawDoc("objectwithtext.fodg");
