From eb358d77291eba677141bab113dc27d7aabb0f3e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:44:04 +0200 Subject: Merging upstream version 4:24.2.2. Signed-off-by: Daniel Baumann --- vcl/qa/cppunit/pdfexport/data/tdf159817.fodt | 607 +++++++++++++++++++++++++++ vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 56 +++ 2 files changed, 663 insertions(+) create mode 100644 vcl/qa/cppunit/pdfexport/data/tdf159817.fodt (limited to 'vcl/qa') diff --git a/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt b/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt new file mode 100644 index 0000000000..6aa986bdc6 --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf159817.fodt @@ -0,0 +1,607 @@ + + + + LibreOfficeDev/24.8.0.0.alpha0$MacOSX_AARCH64 LibreOffice_project/d8978a8c4ffabd6b36a691fd3e2df685638082342003-10-02T15:57:292024-03-03T15:16:09.338790904880P124DT12H36M25S2024-02-21T10:01:49.801000000Fichiers PDF + + + 0 + 0 + 20717 + 10631 + false + false + + + view2 + 11534 + 5101 + 0 + 0 + 20715 + 10629 + 0 + 1 + false + 140 + false + false + false + true + false + false + + + + + 0 + true + false + false + false + true + false + true + false + + true + false + false + false + false + true + false + false + 0 + false + false + false + false + false + true + false + false + false + false + false + true + false + 449756 + true + true + true + false + false + false + false + false + false + false + true + true + false + false + true + false + 20255833 + false + false + false + false + false + false + true + false + false + false + false + true + false + + true + false + false + false + true + false + false + true + false + false + false + 0 + false + true + false + false + false + true + false + 1 + false + false + true + low-resolution + Canon iP7200 series + false + 0 + + true + true + + + false + false + true + true + false + false + false + false + false + false + false + NQH+/0Nhbm9uIGlQNzIwMCBzZXJpZXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ2Fub24gaVA3MjAwIHNlcmllcy1BaXJQcmludAAAAAAWAAQABAAAAAAAAAAEAAhSAAAEdAAAAAAAABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3duDABQUklOVEVSX05BTUUTAENhbm9uIGlQNzIwMCBzZXJpZXMLAERSSVZFUl9OQU1FHABDYW5vbiBpUDcyMDAgc2VyaWVzLUFpclByaW50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page 0/ 1Votre paraphe : + + + + + + + + + + + + + Page 1/ 1Votre paraphe : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propriétaire Locataire Occupant à titre gratuit + + Incendie + + + + + \ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index d2811f32fb..38e3629497 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -41,6 +41,7 @@ #include #include +#include using namespace ::com::sun::star; @@ -4851,6 +4852,61 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf156528) bounds.getHeight(), 1); } +// Form controls coordinates scrambled when exporting to pdf with unchecked form creation in Writer +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159817) +{ + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + + // Enable PDF/UA + uno::Sequence aFilterData( + comphelper::InitPropertySequence({ { "ExportFormFields", uno::Any(false) } })); + aMediaDescriptor["FilterData"] <<= aFilterData; + saveAsPDF(u"tdf159817.fodt"); + + std::unique_ptr pPdfDocument = parsePDFExport(); + + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + std::unique_ptr pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); + CPPUNIT_ASSERT(pPdfPage); + std::unique_ptr pTextPage = pPdfPage->getTextPage(); + CPPUNIT_ASSERT(pTextPage); + + // So I extracted these values by using SAL_WARN(... << ...getMinimum()), but it appears + // that the C++ stream operators do not output double values with sufficient resolution for me + // to recreate those values in code, sigh, so resort to rounding things. + auto roundPoint = [&pPdfPage](int i) { + auto p = pPdfPage->getObject(i)->getBounds().getMinimum(); + return basegfx::B2DPoint(std::floor(p.getX() * 10) / 10.0, + std::floor(p.getY() * 10) / 10.0); + }; + // before the fix these co-ordinates would have been way further down the page + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(8.6, 677.3), roundPoint(13)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(9.3, 677.9), roundPoint(14)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(9.8, 678.5), roundPoint(15)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(85.0, 677.3), roundPoint(16)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(85.6, 677.9), roundPoint(17)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(170.1, 677.3), roundPoint(18)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(170.6, 677.9), roundPoint(19)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(0.0, 654.0), roundPoint(20)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(0.6, 654.6), roundPoint(21)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.3, 655.5), roundPoint(22)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.3, 655.5), roundPoint(23)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.2, 655.5), roundPoint(24)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.2, 655.5), roundPoint(25)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.4, 655.5), roundPoint(26)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.4, 655.5), roundPoint(27)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.1, 655.5), roundPoint(28)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.1, 655.5), roundPoint(29)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.5, 655.5), roundPoint(30)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.5, 655.5), roundPoint(31)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.0, 655.5), roundPoint(32)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(1.0, 655.5), roundPoint(33)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 641.4), roundPoint(34)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 623.7), roundPoint(35)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(28.3, 623.8), roundPoint(36)); + CPPUNIT_ASSERT_EQUAL(basegfx::B2DPoint(138.6, 623.7), roundPoint(37)); +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit v1.2.3