diff options
author | Justin Luth <justin_luth@sil.org> | 2017-09-18 14:57:47 -0400 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-12-04 15:05:01 +0100 |
commit | b360322c63d62b54b5e6adac4def3f8b761dc1da (patch) | |
tree | 1cf5343a25d62ca5650c8c863bd74734f2749e86 /sw | |
parent | b39b9b5822aa084cfa3ef85908c9cb504165277f (diff) |
tdf#97648 ooxmlimport: calculate percentage-based widths
MSO seems to write 100% width horizontal lines with a
"suggested" width of 0, so we need to calculate what
the proper width is.
A better fix would be to add "percentage-width" support
to the shape class itself, but that complex enhancement
is way beyond my abilities.
Limiting the patch ONLY to shapes with an undefined
width because it otherwise slightly increases the
size of various other unit tests, and I'm not sure
if those are desirable changes or not. The list of
the unit tests is documented in the bug report.
Change-Id: Ied80beca42a7513b8ea3b94b9c4ea9898e787200
Reviewed-on: https://gerrit.libreoffice.org/42128
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf97648_relativeWidth.docx | bin | 38145 -> 17613 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 6 |
3 files changed, 6 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf97648_relativeWidth.docx b/sw/qa/extras/ooxmlexport/data/tdf97648_relativeWidth.docx Binary files differindex 8419113f1617..686fd6803ade 100644 --- a/sw/qa/extras/ooxmlexport/data/tdf97648_relativeWidth.docx +++ b/sw/qa/extras/ooxmlexport/data/tdf97648_relativeWidth.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index dddc7b2b918c..66eda44719f8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -228,12 +228,10 @@ DECLARE_OOXMLEXPORT_TEST(tdf105490_negativeMargins, "tdf105490_negativeMargins.d DECLARE_OOXMLEXPORT_TEST(testTdf97648_relativeWidth,"tdf97648_relativeWidth.docx") { - int i = mbExported ? 0 : 1; - //divide everything by 10 to avoid rounding errors etc - CPPUNIT_ASSERT_EQUAL( sal_Int32(15995/10), getShape(++i)->getSize().Width/10); - CPPUNIT_ASSERT_EQUAL( sal_Int32(8001/10), getShape(++i)->getSize().Width/10); - CPPUNIT_ASSERT_EQUAL( sal_Int32(4001/10), getShape(++i)->getSize().Width/10); - CPPUNIT_ASSERT_EQUAL( sal_Int32(1600/10), getShape(++i)->getSize().Width/10); + CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(7616), getShape(1)->getSize().Width, 10); + CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(8001), getShape(2)->getSize().Width, 10); + CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(4001), getShape(3)->getSize().Width, 10); + CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(1600), getShape(4)->getSize().Width, 10); } DECLARE_OOXMLEXPORT_TEST(testTdf104061_tableSectionColumns,"tdf104061_tableSectionColumns.docx") diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index fabf17d152e9..b3bb4f4e0a5f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -418,11 +418,9 @@ DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf") // the thin horizontal rule was imported as a big fat rectangle uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xShape, "RelativeWidth")); - // FIXME the width/height numbers here are bogus; they should be 15238 / 53 - // (as they are when opening the file in a full soffice) + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(15238), xShape->getSize().Width, 10); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(53), xShape->getSize().Height, 10); #if 0 - CPPUNIT_ASSERT_EQUAL(sal_Int32(15238), xShape->getSize().Width); - CPPUNIT_ASSERT_EQUAL(sal_Int32(53), xShape->getSize().Height); CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xShape, "VertOrient")); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xShape, "HoriOrient")); #endif |