summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx2
-rw-r--r--sw/qa/extras/ooxmlimport/data/tcw-rounding.docxbin0 -> 14876 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx4
4 files changed, 9 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 3a8502b51e6d..e187959c3013 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -295,7 +295,7 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx")
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
- CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").match("6138"));
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6137), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
}
DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.docx")
diff --git a/sw/qa/extras/ooxmlimport/data/tcw-rounding.docx b/sw/qa/extras/ooxmlimport/data/tcw-rounding.docx
new file mode 100644
index 000000000000..d4055c953b6f
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tcw-rounding.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d4d17663fdec..3a541ad33398 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2391,6 +2391,12 @@ static OString dateTimeToString( const util::DateTime& dt )
return DateTimeToOString( DateTime( Date( dt.Day, dt.Month, dt.Year ), tools::Time( dt.Hours, dt.Minutes, dt.Seconds )));
}
+DECLARE_OOXMLIMPORT_TEST(testTcwRounding, "tcw-rounding.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());
+}
+
DECLARE_OOXMLIMPORT_TEST(testBnc821804, "bnc821804.docx")
{
CPPUNIT_ASSERT_EQUAL( OUString( "TITLE" ), getRun( getParagraph( 1 ), 1 )->getString());
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 0caba6530041..15f439791582 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -34,6 +34,7 @@
#include <ooxml/resourceids.hxx>
#include <dmapperLoggers.hxx>
#include <dmapper/DomainMapper.hxx>
+#include <rtl/math.hxx>
namespace writerfilter {
namespace dmapper {
@@ -745,8 +746,7 @@ void DomainMapperTableManager::endOfRowAction()
for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount )
fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
- sal_Int16 nRelPos =
- sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative);
+ sal_Int16 nRelPos = rtl::math::round((fGridWidth * 10000) / nFullWidthRelative);
pSeparators[nBorder].Position = nRelPos + nLastRelPos;
pSeparators[nBorder].IsVisible = sal_True;