From 799522882159b839cc7aeec2fbc48f767507a30c Mon Sep 17 00:00:00 2001 From: Szabolcs Toth Date: Wed, 28 Oct 2020 09:50:00 +0100 Subject: tdf#137642 VML shape import: fix alignment from top margin Use the new define PAGE_PRINT_AREA_TOP at import. Everything else is handled in the previous patches. Change-Id: Ie801ab71a33a657551dbc5bfb63d1491aaa73abd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104923 Tested-by: Jenkins Reviewed-by: Balazs Varga --- .../data/tdf137642_Vertical_Alignment_toppage.docx | Bin 0 -> 13163 bytes sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 34 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx (limited to 'sw/qa') diff --git a/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx new file mode 100644 index 000000000000..fbe8b264bbc4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 4c0dfbf9ebbb..b9f01391e3f2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1560,8 +1560,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx") assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf137641_RelativeFromTopMargin.docx") +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginDML, "tdf137641_RelativeFromTopMargin.docx") { + // Import as DML. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, @@ -1590,6 +1591,37 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf1376 "center"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginVML, "tdf137642_Vertical_Alignment_toppage.docx") +{ + // Import as VML. + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + + assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "top"); + assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "bottom"); + assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "center"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit