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: */