dev/null                                                 |binary
 sw/qa/extras/ooxmlexport/data/tdf123104.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx               |   12 +++++++++---
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx                |    2 +-
 sw/qa/extras/rtfexport/rtfexport.cxx                     |    2 +-
 sw/qa/extras/rtfexport/rtfexport3.cxx                    |    4 ++--
 sw/qa/extras/rtfexport/rtfexport5.cxx                    |    2 +-
 sw/qa/extras/rtfimport/rtfimport.cxx                     |    2 +-
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    3 ++-
 9 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit e502463fa9a601963aa9f5a8783eb1318de36c13
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Mar 11 21:40:44 2019 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Mar 12 08:43:22 2019 +0100

    tdf#123104 DOCX import: fix lack of vertical merge due to rounding
    
    Regression from commit 29cbbad64088354425c606f9eb6c267bdf7731dc (DOCX
    import: fix rounding error in table cell widths, 2014-11-07), which
    changed truncation to rounding for the twips -> 1/10000th of relative
    width conversion during import, but left export unchanged.
    
    But adapting the export is not that easy: one part would be the
    std::unique() call in
    WW8TableNodeInfoInner::getColumnWidthsBasedOnAllRows() to not require
    exact comparison, but doing so has it own side effects (multiple failing
    tests).
    
    So just revert the mentioned commit, as a minor rounding error is much
    better than a broken vertical merge. And once it's clear how to adapt
    export at the same time, this rounding on the import side can be
    re-introduced.
    
    Change-Id: I9e01ea5cc2c2f8aabe1e21cb8118c9c0e2c45494
    Reviewed-on: https://gerrit.libreoffice.org/69065
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tcw-rounding.docx 
b/sw/qa/extras/ooxmlexport/data/tcw-rounding.docx
deleted file mode 100644
index d4055c953b6f..000000000000
Binary files a/sw/qa/extras/ooxmlexport/data/tcw-rounding.docx and /dev/null 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123104.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123104.docx
new file mode 100644
index 000000000000..73cad8617c7e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123104.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index b3494c754f16..009b77069055 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -746,10 +746,16 @@ DECLARE_OOXMLEXPORT_TEST(testBnc891663, "bnc891663.docx")
     CPPUNIT_ASSERT( textNextRowTop >= imageTop + imageHeight );
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTcwRounding, "tcw-rounding.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf123104, "tdf123104.docx")
 {
-    // Width of the A1 cell in twips was 3200, due to a rounding error.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3201),  
parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32());
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<table::XCell> xCell = xTable->getCellByName("E1");
+    // See SwXCell::getPropertyValue(), we really put 'long' into an Any there.
+    // Without the accompanying fix in place, this test would have failed with 
'Expected: 3;Actual :
+    // 2', i.e. the vertical merge covered one less cell, resulting in a cell 
with white background.
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>(3), getProperty<long>(xCell, 
"RowSpan"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo85542, "fdo85542.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index f4977f1f339a..5a27c6cec264 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -298,7 +298,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>(6137), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6138), 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/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 22ed642dde67..6fa603c60b8c 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1353,7 +1353,7 @@ DECLARE_RTFEXPORT_TEST(testTdf112507, "tdf112507.rtf")
     // First table's second row had 3 cells (so 2 separators).
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aSeparators.getLength());
     // This was 3333, i.e. the B2 cell was too narrow and the text needed 2 
lines.
-    CPPUNIT_ASSERT_GREATER(5000, aSeparators[1].Position - 
aSeparators[0].Position);
+    CPPUNIT_ASSERT_GREATEREQUAL(5000, aSeparators[1].Position - 
aSeparators[0].Position);
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf107480, "tdf107480.rtf")
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 487a2530ea0c..85336a3ec453 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -124,10 +124,10 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx")
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Row width", sal_Int32(9360), rowWidth);
     sal_Int32 cell1Width
         = parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", 
"width").toInt32();
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("First cell width", sal_Int32(9142), 
cell1Width);
+    CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width >= 9140 && 
cell1Width <= 9142);
     sal_Int32 cell2Width
         = parseDump("/root/page/body/tab/row/cell[2]/infos/bounds", 
"width").toInt32();
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("First cell width", sal_Int32(218), 
cell2Width);
+    CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218 && 
cell2Width <= 220);
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 2fb059831e97..d4e9a68b7f14 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -933,7 +933,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(2300), 
getProperty<uno::Sequence<text::TableColumnSeparator>>(
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), 
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 6b50be5fe8d9..17c59501c34b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -461,7 +461,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(897), 
getProperty<uno::Sequence<text::TableColumnSeparator>>(
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(896), 
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 94cf9ca8f9f7..ffee824e6973 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -664,7 +664,8 @@ void DomainMapperTableManager::endOfRowAction()
                 for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; 
--nGridCount )
                     fGridWidth += (*pTableGrid)[nBorderGridIndex++];
 
-                sal_Int16 nRelPos = rtl::math::round((fGridWidth * 10000) / 
nFullWidthRelative);
+                sal_Int16 nRelPos =
+                    sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / 
nFullWidthRelative);
 
                 pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
                 pSeparators[nBorder].IsVisible = true;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to