tdf#139549 add test to commit 2ffdd37067

(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 <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
Tünde Tóth 2021-06-29 10:40:04 +02:00 committed by László Németh
parent 3d8b070938
commit 02809c8b53
2 changed files with 39 additions and 0 deletions

Binary file not shown.

View file

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