summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-09-05 13:06:27 -0400
committerJustin Luth <justin_luth@sil.org>2017-09-13 04:16:39 +0200
commitffc3358515799057e72379b76a1165c6ea5a9bd1 (patch)
tree8e11f55eecdfe2b463912851e909fe1e1a4fda8e /sw/qa/extras
parent33ead25229d308f98fa171412f2937ca0ba976e9 (diff)
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/41957 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ww8export/data/tdf75539_relativeWidth.docbin0 -> 50176 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx11
2 files changed, 11 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
new file mode 100644
index 000000000000..ac811a8f3599
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 131c8e85b329..38f41d83bf49 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -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