summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorBakos Attila <bakos.attilakaroly@nisz.hu>2019-11-05 15:30:22 +0100
committerLászló Németh <nemeth@numbertext.org>2019-11-09 18:20:27 +0100
commitc401aa9f632758157021c2c45c5cc4d00ee12dab (patch)
tree4f09134cb701f283a7c16695c476fb8184abd8c6 /sw/qa
parent6070ef641f56cb826df884fdd846882c39a01342 (diff)
tdf124367 DOCX import: fix rounding error in table cell widths
Follow-up of commit 29cbbad64088354425c606f9eb6c267bdf7731dc (DOCX import: fix rounding error in table cell widths), its revert in commit e502463fa9a601963aa9f5a8783eb1318de36c13 (tdf#123104 DOCX import: fix lack of vertical merge due to rounding) and commit 44e44239de35c1548809c96e13bfa9d64c7ca441 (tdf#120315 DOCX import: fix cells merged vertically). Change-Id: Id85e8fd25dba26af77fe2fd3024db2ae834b5052 Reviewed-on: https://gerrit.libreoffice.org/82072 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf124367.docxbin0 -> 12180 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx14
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx5
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx2
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx2
6 files changed, 21 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124367.docx b/sw/qa/extras/ooxmlexport/data/tdf124367.docx
new file mode 100644
index 000000000000..0a1356dd0d2b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124367.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c7f022d68311..12950c8451a7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -108,6 +108,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx")
assertXPath(pXmlSettings, "/w:settings/w:hyphenationZone", "val", "851");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows();
+ // it was 2761 at the first import, and 2760 at the second import, due to incorrect rounding
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2762),
+ getProperty<uno::Sequence<text::TableColumnSeparator>>(
+ xTableRows->getByIndex(2), "TableColumnSeparators")[0]
+ .Position);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index f2ce3fb3fe2a..a09479e44ea0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -272,7 +272,7 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx")
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6138), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6137), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
// tdf#106572 - preventative test matching danger conditions, but imported OK anyway
CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(getParagraphOrTable(1), "PageDescName"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index a46e3fb5eb63..e5b4ffc9cfdd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -884,7 +884,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx")
uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows();
// Was 9997, so the 4th column had ~zero width
- CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position);
+ CPPUNIT_ASSERT_LESSEQUAL(2, (sal_Int16(7500)
+ - getProperty<uno::Sequence<text::TableColumnSeparator>>(
+ xTableRows->getByIndex(0), "TableColumnSeparators")[2]
+ .Position));
}
DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, "conditionalstyles-tbllook.docx")
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index e74e79073348..2a44ad72f1ff 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -944,7 +944,7 @@ DECLARE_RTFEXPORT_TEST(testTdf97035, "tdf97035.rtf")
// First cell width of the second row should be 2300
uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
- CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), getProperty<uno::Sequence<text::TableColumnSeparator>>(
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2300), getProperty<uno::Sequence<text::TableColumnSeparator>>(
xTableRows->getByIndex(1), "TableColumnSeparators")[0]
.Position);
}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index d13ba58410f2..ce693e11f717 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -471,7 +471,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo55525)
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty<sal_Int32>(xTable, "LeftMargin"));
// Cell width of A1 was 3332 (e.g. not set, 30% percent of total width)
uno::Reference<table::XTableRows> xTableRows = xTable->getRows();
- CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty<uno::Sequence<text::TableColumnSeparator>>(
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(897), getProperty<uno::Sequence<text::TableColumnSeparator>>(
xTableRows->getByIndex(0), "TableColumnSeparators")[0]
.Position);
}