[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source

Bakos Attila (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 13 08:33:43 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 23d8c2b148f88575a9c971602d3a1bc71dabf0b1
Author:     Bakos Attila <bakos.attilakaroly at nisz.hu>
AuthorDate: Tue Nov 5 15:30:22 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Nov 13 09:33:07 2019 +0100

    tdf#124367 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
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/82421
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Miklos Vajna <vmiklos at collabora.com>

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 a0a7f4169a1f..0d6d771b7362 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 ac0cd45112fb..b26a8a737d4a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -271,7 +271,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 f798ad98000e..4a033ec79df0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -883,7 +883,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx")
 
     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
     // 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 7f11ece22fa8..7c734c42a932 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -948,7 +948,7 @@ DECLARE_RTFEXPORT_TEST(testTdf97035, "tdf97035.rtf")
 
     // First cell width of the second row should be 2300
     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
-    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 aa00c568f336..334b48c80809 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -450,7 +450,7 @@ DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf")
     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(), uno::UNO_QUERY);
-    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 368e4b59c411..ea26eca7b973 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -657,9 +657,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