sw/qa/extras/ooxmlexport/data/tdf139549.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 39 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)
New commits: commit 02809c8b53e225ea45952de66d1b634267c8f28b Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Tue Jun 29 10:40:04 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Jul 1 09:59:17 2021 +0200 tdf#139549 add test to commit 2ffdd37067926ddb841c6055205f267b96706945 (tdf#139549 DOCX import: document got modified at import time) to check the fixed position of the frame. Note: to test it under Linux, use SAL_USE_VCLPLUGIN=gen: $ make CPPUNIT_TEST_NAME=testTdf139549 CppunitTest_sw_ooxmlexport16 SAL_USE_VCLPLUGIN=gen Change-Id: I13ddfd5b5b4568bc7eb164cbda23f1d99fcab443 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118074 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf139549.docx b/sw/qa/extras/ooxmlexport/data/tdf139549.docx new file mode 100644 index 000000000000..6e76ae57c02f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139549.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index bafe3b511730..ecd0e4b62803 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -587,6 +587,45 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_ShadowDirection, "tdf142361ShadowDirect "rotWithShape", "0"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf139549, "tdf139549.docx") +{ + // Document contains a VML textbox, the position of the textbox was incorrect. + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + OUString aStyle = getXPath(pXmlDoc, "//w:pict/v:shape", "style"); + /* original is: "position:absolute;margin-left:138.5pt;margin-top:40.1pt;width:183pt; + height:68pt;z-index:251675648;mso-position-horizontal:absolute; + mso-position-horizontal-relative:page;mso-position-vertical:absolute; + mso-position-vertical-relative:page" */ + CPPUNIT_ASSERT(!aStyle.isEmpty()); + + sal_Int32 nextTokenPos = 0; + OUString aStyleCommand = aStyle.getToken(0, ';', nextTokenPos); + CPPUNIT_ASSERT(!aStyleCommand.isEmpty()); + + OUString aStyleCommandName = aStyleCommand.getToken(0, ':'); + OUString aStyleCommandValue = aStyleCommand.getToken(1, ':'); + CPPUNIT_ASSERT_EQUAL(OUString("position"), aStyleCommandName); + CPPUNIT_ASSERT_EQUAL(OUString("absolute"), aStyleCommandValue); + + aStyleCommand = aStyle.getToken(0, ';', nextTokenPos); + CPPUNIT_ASSERT(!aStyleCommand.isEmpty()); + + aStyleCommandName = aStyleCommand.getToken(0, ':'); + aStyleCommandValue = aStyleCommand.getToken(1, ':'); + CPPUNIT_ASSERT_EQUAL(OUString("margin-left"), aStyleCommandName); + // Without the fix it failed, because the margin-left was 171.85pt. + CPPUNIT_ASSERT_DOUBLES_EQUAL(138.5, aStyleCommandValue.toFloat(), 0.1); + + aStyleCommand = aStyle.getToken(0, ';', nextTokenPos); + CPPUNIT_ASSERT(!aStyleCommand.isEmpty()); + + aStyleCommandName = aStyleCommand.getToken(0, ':'); + aStyleCommandValue = aStyleCommand.getToken(1, ':'); + CPPUNIT_ASSERT_EQUAL(OUString("margin-top"), aStyleCommandName); + // Without the fix it failed, because the margin-top was 55.45pt. + CPPUNIT_ASSERT_DOUBLES_EQUAL(40.1, aStyleCommandValue.toFloat(), 0.1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits