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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 07:16:21 PST 2012


 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                 |    4 ++--
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7705a50ba330cd3fa08f5edfe6617d9acde8e8a5
Author: Pierre-Eric Pelloux-Prayer <pierre-eric at lanedo.com>
Date:   Tue Nov 6 13:49:27 2012 +0100

    docx import: round float value to int when computing cells width
    
    Previously, truncating float to int was introducing accumulating
    rounding errors, which lead to visible change in column widths.
    
    Change-Id: I4557c716fba48dfd9a6c1c4d2cd0d0aa7aeae865

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d19760f..33112d4 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1013,8 +1013,8 @@ void Test::testN785767()
     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
     // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row).
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(36), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(978), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
+    CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
+    CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index d3752c7..0038da2 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -478,7 +478,7 @@ void DomainMapperTableManager::endOfRowAction()
             }while( --nGridCount );
 
             sal_Int16 nRelPos =
-                sal::static_int_cast< sal_Int16 >(fGridWidth * nFullWidthRelative / nFullWidth );
+                sal::static_int_cast< sal_Int16 >( round( fGridWidth * nFullWidthRelative / nFullWidth ) );
 
             pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
             pSeparators[nBorder].IsVisible = sal_True;


More information about the Libreoffice-commits mailing list