Kaydet (Commit) ffc33585 authored tarafından Justin Luth's avatar Justin Luth

tdf#75539 ww8import: fix horizontalLine percentage

The formula previously divided by 1000, which was a common
dxaGoal width from MSO2003 (based on round-trip testing).
But for the bug document, that formuala didn't work.

An "assert (false)" with "make check" indicates that only
unit test n757118.doc contains a percentage-derived width,
and that test also has dxaGoal == 1000. So, my pool of
test documents is pretty small, but it seems logical that
this is a better formula since it fixes an obviously
bad example, and explains why it "worked before".

Change-Id: I7bf666e88e7e59e06bbfa3c0961fa8eabbc80310
Reviewed-on: https://gerrit.libreoffice.org/41957Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 33ead252
This diff was suppressed by a .gitattributes entry.
......@@ -261,6 +261,17 @@ xray ThisComponent.DrawPage.getByIndex(0).BoundRect
CPPUNIT_ASSERT( abs( boundRect2.Width - boundRect4.Width ) < 5 );
}
DECLARE_WW8EXPORT_TEST(testTdf75539_relativeWidth, "tdf75539_relativeWidth.doc")
{
//divide everything by 10 to give a margin of error for rounding etc.
sal_Int32 pageWidth = parseDump("/root/page[1]/body/infos/bounds", "width").toInt32()/10;
CPPUNIT_ASSERT_EQUAL_MESSAGE("Page width", sal_Int32(9354/10), pageWidth);
CPPUNIT_ASSERT_EQUAL_MESSAGE("100% width line", pageWidth, parseDump("/root/page[1]/body/txt[2]/Special", "nWidth").toInt32()/10);
CPPUNIT_ASSERT_EQUAL_MESSAGE("50% width line", pageWidth/2, parseDump("/root/page[1]/body/txt[4]/Special", "nWidth").toInt32()/10);
CPPUNIT_ASSERT_EQUAL_MESSAGE("25% width line", pageWidth/4, parseDump("/root/page[1]/body/txt[6]/Special", "nWidth").toInt32()/10);
CPPUNIT_ASSERT_EQUAL_MESSAGE("10% width line", pageWidth/10, parseDump("/root/page[1]/body/txt[8]/Special", "nWidth").toInt32()/10);
}
DECLARE_WW8EXPORT_TEST(testN757905, "n757905.doc")
{
// The problem was that the paragraph had only a single fly
......
......@@ -580,7 +580,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj,
aPic.mx = msword_cast<sal_uInt16>(
m_aSectionManager.GetPageWidth() -
m_aSectionManager.GetPageRight() -
m_aSectionManager.GetPageLeft()) * relativeWidth / 1000;
m_aSectionManager.GetPageLeft()) * relativeWidth / aPic.dxaGoal;
aPD = WW8PicDesc( aPic );
// This SetSnapRect() call adjusts the size of the
// object itself, no idea why it's this call (or even
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment