summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-09-09 12:49:13 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-10 07:27:09 +0000
commitf4dad76732328dfaa0ff16f810d6ee0a3bfd0d8c (patch)
tree0dcdca03a594a8e9535c264b91512ea7eac01111 /sw
parenta41d72333d15c609f0441bd7df1722b31297756d (diff)
Improve border equal check in filter tests 2.
Change the order of words BORDER and EQUAL in the macro name to become consistent with other macro names. e.g. CPPUNIT_ASSERT_DOUBLES_EQUAL Use a function inside the macro to make it type safe. Add additional message to make clear why the test failed. Change-Id: I9fc7a5813adf2cac36ae831d438cec498232b06c Reviewed-on: https://gerrit.libreoffice.org/5885 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx16
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx22
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx40
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx8
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx8
6 files changed, 51 insertions, 51 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index b2dfcf012dd4..6ebaad50d3d7 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -57,18 +57,10 @@ void Test::testCharacterBorder()
uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
// Different Border
{
- CPPUNIT_ASSERT_EQUAL_BORDER(
- table::BorderLine2(0x6666FF,12,12,12,3,37),
- getProperty<table::BorderLine2>(xRun,"CharTopBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(
- table::BorderLine2(0xFF9900,0,99,0,2,99),
- getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(
- table::BorderLine2(0xFF0000,0,169,0,1,169),
- getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(
- table::BorderLine2(0x0000FF,0,169,0,0,169),
- getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x6666FF,12,12,12,3,37), getProperty<table::BorderLine2>(xRun,"CharTopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF9900,0,99,0,2,99), getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF0000,0,169,0,1,169), getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0000FF,0,169,0,0,169), getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
}
// Different Padding
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 254aabef60ca..353cd63e254f 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -37,13 +37,6 @@
using namespace com::sun::star;
#define DEFAULT_STYLE "Default Style"
-#define CPPUNIT_ASSERT_EQUAL_BORDER(aExpected, aActual) \
- CPPUNIT_ASSERT_EQUAL(aExpected.Color, aActual.Color); \
- CPPUNIT_ASSERT_EQUAL(aExpected.InnerLineWidth, aActual.InnerLineWidth); \
- CPPUNIT_ASSERT_EQUAL(aExpected.LineDistance, aActual.LineDistance); \
- CPPUNIT_ASSERT_EQUAL(aExpected.LineStyle, aActual.LineStyle); \
- CPPUNIT_ASSERT_EQUAL(aExpected.LineWidth, aActual.LineWidth); \
- CPPUNIT_ASSERT_EQUAL(aExpected.OuterLineWidth, aActual.OuterLineWidth);
/// Base class for filter tests loading or roundtriping a document, then asserting the document model.
class SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
@@ -366,4 +359,19 @@ protected:
sal_uInt32 m_nStartTime;
};
+inline void assertBorderEqual(
+ const table::BorderLine2& rExpected, const table::BorderLine2& rActual,
+ const CppUnit::SourceLine& rSourceLine )
+{
+ CPPUNIT_NS::assertEquals<util::Color>( rExpected.Color, rActual.Color, rSourceLine, "different Color" );
+ CPPUNIT_NS::assertEquals<sal_Int16>( rExpected.InnerLineWidth, rActual.InnerLineWidth, rSourceLine, "different InnerLineWidth" );
+ CPPUNIT_NS::assertEquals<sal_Int16>( rExpected.OuterLineWidth, rActual.OuterLineWidth, rSourceLine, "different OuterLineWidth" );
+ CPPUNIT_NS::assertEquals<sal_Int16>( rExpected.LineDistance, rActual.LineDistance, rSourceLine, "different LineDistance" );
+ CPPUNIT_NS::assertEquals<sal_Int16>( rExpected.LineStyle, rActual.LineStyle, rSourceLine, "different LineStyle" );
+ CPPUNIT_NS::assertEquals<sal_Int32>( rExpected.LineWidth, rActual.LineWidth, rSourceLine, "different LineWidth" );
+}
+
+#define CPPUNIT_ASSERT_BORDER_EQUAL(aExpected, aActual) \
+ assertBorderEqual( aExpected, aActual, CPPUNIT_SOURCELINE() ) \
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 35d51fe616c2..437d2c253a0e 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -181,19 +181,19 @@ void Test::testCharacterBorder()
uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY);
// Top border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"TopBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"TopBorderDistance"));
// Bottom border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"BottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"BottomBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"BottomBorderDistance"));
// Left border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"LeftBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"LeftBorderDistance"));
// Right border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"RightBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"RightBorderDistance"));
// Shadow
@@ -211,19 +211,19 @@ void Test::testCharacterBorder()
uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY);
// Top border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharTopBorderDistance"));
// Bottom border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharBottomBorderDistance"));
// Left border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharLeftBorderDistance"));
// Right border (same as top border)
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharRightBorderDistance"));
// Shadow
@@ -243,19 +243,19 @@ void Test::testCharacterBorder()
uno::Reference < beans::XPropertySet > xPSet( xAutoStylesEnum->nextElement(), uno::UNO_QUERY );
// Top border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharTopBorderDistance"));
// Bottom border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharBottomBorderDistance"));
// Left border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharLeftBorderDistance"));
// Right border
- CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharRightBorderDistance"));
}
}
@@ -278,19 +278,19 @@ void Test::testCharacterBorder()
uno::Reference < beans::XPropertySet > xSet( getRun(getParagraph(2),2), uno::UNO_QUERY );
// Top border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[0], getProperty<sal_Int32>(xSet,"CharTopBorderDistance"));
// Bottom border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[1], getProperty<sal_Int32>(xSet,"CharBottomBorderDistance"));
// Left border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[2], getProperty<sal_Int32>(xSet,"CharLeftBorderDistance"));
// Right border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[3], getProperty<sal_Int32>(xSet,"CharRightBorderDistance"));
// Shadow
@@ -306,19 +306,19 @@ void Test::testCharacterBorder()
uno::Reference < beans::XPropertySet > xStyleSet(xStyleFamily->getByName("CharDiffBor"), uno::UNO_QUERY);
// Top border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[0], getProperty<sal_Int32>(xSet,"CharTopBorderDistance"));
// Bottom border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[1], getProperty<sal_Int32>(xSet,"CharBottomBorderDistance"));
// Left border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[2], getProperty<sal_Int32>(xSet,"CharLeftBorderDistance"));
// Right border
- CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder"));
CPPUNIT_ASSERT_EQUAL(aDistances[3], getProperty<sal_Int32>(xSet,"CharRightBorderDistance"));
}
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3befcd5896a0..298c10e0e1bb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1283,10 +1283,10 @@ void Test::testCharacterBorder()
// Border
{
const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
- CPPUNIT_ASSERT_EQUAL_BORDER(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
}
// Padding (w:space)
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 779037f9488d..64eb1beb3122 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -643,10 +643,10 @@ void Test::testCharacterBorder()
// Border
{
const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
- CPPUNIT_ASSERT_EQUAL_BORDER(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
}
// Padding (brsp)
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 3e23f0a3cf3e..a9e41181365a 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -156,10 +156,10 @@ void Test::testCharacterBorder()
{
const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
// In the original ODT file the border color is 0xFF3333
- CPPUNIT_ASSERT_EQUAL_BORDER(table::BorderLine2(0xFF0000,0,318,0,0,318), aTopBorder);
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
- CPPUNIT_ASSERT_EQUAL_BORDER(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF0000,0,318,0,0,318), aTopBorder);
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
}
// Padding (dptSpace) it is constant 0