[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source
LuboÅ¡ LuÅák
l.lunak at centrum.cz
Tue Mar 18 12:57:28 PDT 2014
sw/qa/extras/inc/swmodeltestbase.hxx | 10 +++++-----
sw/qa/extras/ooxmlimport/data/fdo38414.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 +++++++
sw/source/core/table/swnewtable.cxx | 16 +++++++++++++---
4 files changed, 25 insertions(+), 8 deletions(-)
New commits:
commit 075fc0c0a34875adf2833e5933b4982b9443a373
Author: LuboÅ¡ LuÅák <l.lunak at centrum.cz>
Date: Tue Mar 18 19:29:29 2014 +0100
testcase for fdo#38414
Change-Id: I9467ae2ba5155175d5be8218248edada136a5ca1
diff --git a/sw/qa/extras/ooxmlimport/data/fdo38414.docx b/sw/qa/extras/ooxmlimport/data/fdo38414.docx
new file mode 100644
index 0000000..135cd32
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo38414.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e47a208..87571c8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1997,6 +1997,13 @@ DECLARE_OOXMLIMPORT_TEST(testLargeTwips, "large-twips.docx" )
CPPUNIT_ASSERT( width.toInt32() > 0 );
}
+DECLARE_OOXMLIMPORT_TEST(testFdo38414, "fdo38414.docx" )
+{
+ // The cells in the last (4th) column were merged properly and so the result didn't have the same height.
+ OUString height3 = parseDump("/root/page/body/tab/row[1]/cell[3]/infos/bounds", "height" );
+ OUString height4 = parseDump("/root/page/body/tab/row[1]/cell[4]/infos/bounds", "height" );
+ CPPUNIT_ASSERT_EQUAL( height3, height4 );
+}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
commit e1036f0faedcb58897628dcfa8ccbda42b20403c
Author: LuboÅ¡ LuÅák <l.lunak at centrum.cz>
Date: Tue Mar 18 19:17:43 2014 +0100
add messages to utility test functions
So that e.g. parseDump() in case of an incorrect xpath does not just
plain give an equality assertion failure, which on its own is confusing.
Change-Id: Ib9fc2b4f6720b5c472773afbe8dc18cd8961465c
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index e079810..1fb6c48 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -274,7 +274,7 @@ protected:
xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx);
xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
- CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("parsing dump failed", 1, xmlXPathNodeSetGetLength(pXmlNodes));
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
OUString aRet;
if (aAttribute.getLength())
@@ -352,7 +352,7 @@ protected:
uno::Reference<text::XTextRange> const xParagraph(
getParagraphOrTable(number), uno::UNO_QUERY_THROW);
if( !content.isEmpty())
- CPPUNIT_ASSERT_EQUAL( content, xParagraph->getString());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "paragraph does not have expected content", content, xParagraph->getString());
return xParagraph;
}
@@ -360,7 +360,7 @@ protected:
{
uno::Reference<text::XTextRange> const xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW);
if (!content.isEmpty())
- CPPUNIT_ASSERT_EQUAL(content, xParagraph->getString());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "paragraph does not contain expected content", content, xParagraph->getString());
return xParagraph;
}
@@ -373,7 +373,7 @@ protected:
xRunEnum->nextElement();
uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
if( !content.isEmpty())
- CPPUNIT_ASSERT_EQUAL( content, xRun->getString());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "run does not contain expected content", content, xRun->getString());
return xRun;
}
@@ -399,7 +399,7 @@ protected:
{
uno::Reference<text::XText> const xCellText(xCell,
uno::UNO_QUERY_THROW);
- CPPUNIT_ASSERT_EQUAL(rContent, xCellText->getString());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("cell does not contain expected content", rContent, xCellText->getString());
}
return xCell;
}
commit 9970d5d9878bf8b40361606cfad6b25a2b6cc83d
Author: LuboÅ¡ LuÅák <l.lunak at centrum.cz>
Date: Tue Mar 18 18:57:05 2014 +0100
workaround for rounding errors when handling merged cells (fdo#38414)
Change-Id: I4d36e4b86c77a7356a8c221cbfc5735e925392ba
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 26a445a..0186a22 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -198,10 +198,20 @@ static SwTableBox* lcl_LeftBorder2Box( long nLeft, const SwTableLine* pLine )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
OSL_ENSURE( pBox, "Missing table box" );
- if( nCurrLeft >= nLeft && pBox->GetFrmFmt()->GetFrmSize().GetWidth() )
+ if( pBox->GetFrmFmt()->GetFrmSize().GetWidth() )
{
- OSL_ENSURE( nCurrLeft == nLeft, "Wrong box found" );
- return pBox;
+ if( nCurrLeft == nLeft )
+ return pBox;
+ // HACK: It appears that rounding errors may result in positions not matching
+ // exactly, so allow a little tolerance. This happens at least with merged cells
+ // in the doc from fdo#38414 .
+ if( abs( nCurrLeft - nLeft ) <= ( nLeft / 1000 ))
+ return pBox;
+ if( nCurrLeft >= nLeft )
+ {
+ SAL_WARN( "sw.core", "Possibly wrong box found" );
+ return pBox;
+ }
}
nCurrLeft += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
}
More information about the Libreoffice-commits
mailing list