[Libreoffice-commits] core.git: sw/qa writerfilter/source

Bakos Attila (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 9 17:21:39 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf124367.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx               |   14 ++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx                |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx                |    5 ++++-
 sw/qa/extras/rtfexport/rtfexport5.cxx                    |    2 +-
 sw/qa/extras/rtfimport/rtfimport.cxx                     |    2 +-
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    4 ++--
 7 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit c401aa9f632758157021c2c45c5cc4d00ee12dab
Author:     Bakos Attila <bakos.attilakaroly at nisz.hu>
AuthorDate: Tue Nov 5 15:30:22 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Sat Nov 9 18:20:27 2019 +0100

    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 at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>
    Tested-by: Jenkins

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
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124367.docx 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);
 }
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index e09dd45f1642..e29637583631 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -666,9 +666,9 @@ void DomainMapperTableManager::endOfRowAction()
                 for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount )
                     fGridWidth += (*pTableGrid)[nBorderGridIndex++];
 
-                double nRelPos = static_cast<double>((fGridWidth * 10000) / nFullWidthRelative);
+                double nRelPos = (fGridWidth * 10000) / nFullWidthRelative;
 
-                pSeparators[nBorder].Position = sal::static_int_cast< sal_Int16 >( nRelPos + nLastRelPos );
+                pSeparators[nBorder].Position = rtl::math::round(nRelPos + nLastRelPos);
                 pSeparators[nBorder].IsVisible = true;
                 nLastRelPos = nLastRelPos + nRelPos;
                 ++aSpansIter;


More information about the Libreoffice-commits mailing list