diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-10-04 14:41:19 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-10-31 08:52:38 +0100 |
commit | aaa242a33b01e87c41f19fca871cafa857fe71dd (patch) | |
tree | fe791b7ca28a66945c9efa011ebed14de5c735bc /sw/qa/extras | |
parent | ef3dabd1f814d1b005efc5d5144978c1d26a8e73 (diff) |
related tdf#99602 ww8/rtfoutput: fix incorrect rounding on subscripts
Adding .5 is a poor mans version of rounding which works fine with
unsigned numbers, but not with negative numbers. Perhaps use the
exotic round() function instead?
In addition, the font size isn't necessarily an integer,
so that should have been a float.
The result of bad rounding was losing a percentage of the subscript
every round-trip.
Change-Id: I9093f7bfcd0b87249b42562668e45480dcb59f53
Reviewed-on: https://gerrit.libreoffice.org/80218
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index cb4caa351b98..7a4dc17d4ede 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -176,8 +176,12 @@ DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, "tdf120225_textControl DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt") { uno::Reference<text::XTextRange> xPara = getParagraph(2); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1), "CharEscapement"), 0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-33.f, getProperty<float>(getRun(xPara, 2), "CharEscapement"), 3); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Normal text "), "CharEscapement"), 0); + // Automatic escapement SHOULD BE limited by the font bottom line(?) + // and so the calculations ought to be different. There is room for a lot of export improvement here. + // Negative escapements (subscripts) were decreasing by 1% every round-trip due to bad manual rounding. + // The actual number of 33% isn't so important here, but test that it is stable across multiple round-trips. + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Did you fix or break me?", -33.f, getProperty<float>(getRun(xPara, 2), "CharEscapement"), 1); } DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.docx") |