diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-09-08 10:36:44 +0200 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-09-08 11:23:44 +0200 |
commit | d21dd2889199030f3500ce2142182ebb8eb5f18f (patch) | |
tree | 47ea0a677c41d41223f03d16fc7e6841807ba687 /sw | |
parent | 77df2ac92687496a3ae027451364ff833df47e68 (diff) |
Improve border equal check in filter tests
With macro the error message will point to the right line.
Check padding distinct.
Change-Id: Id09fbf65350a7a3708923eb07d673068c2943b50
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 22 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 120 |
2 files changed, 47 insertions, 95 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 895c0969891c..254aabef60ca 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -37,6 +37,13 @@ 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 @@ -347,21 +354,6 @@ protected: return xCursor->getPage(); } - void assertEqualBorder( - const table::BorderLine2& rLeft, const sal_Int32 nLeftDist, - const table::BorderLine2& rRight, const sal_Int32 nRightDist ) - { - // Border - CPPUNIT_ASSERT_EQUAL(rLeft.Color, rRight.Color); - CPPUNIT_ASSERT_EQUAL(rLeft.InnerLineWidth, rRight.InnerLineWidth); - CPPUNIT_ASSERT_EQUAL(rLeft.LineDistance, rRight.LineDistance); - CPPUNIT_ASSERT_EQUAL(rLeft.LineStyle, rRight.LineStyle); - CPPUNIT_ASSERT_EQUAL(rLeft.LineWidth, rRight.LineWidth); - CPPUNIT_ASSERT_EQUAL(rLeft.OuterLineWidth, rRight.OuterLineWidth); - // Padding - CPPUNIT_ASSERT_EQUAL(nLeftDist, nRightDist); - } - uno::Reference<lang::XComponent> mxComponent; xmlBufferPtr mpXmlBuffer; diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 0b104d1b3b6b..efd49dfd1682 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -181,28 +181,20 @@ void Test::testCharacterBorder() uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY); // Top border - assertEqualBorder( - aFirstParTopBorder, aFirstParTopPadding, - getProperty<table::BorderLine2>(xSet,"TopBorder"), - getProperty<sal_Int32>(xSet,"TopBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"TopBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"TopBorderDistance")); // Bottom border (same as top border) - assertEqualBorder( - aFirstParTopBorder, aFirstParTopPadding, - getProperty<table::BorderLine2>(xSet,"BottomBorder"), - getProperty<sal_Int32>(xSet,"BottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"BottomBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"BottomBorderDistance")); // Left border (same as top border) - assertEqualBorder( - aFirstParTopBorder, aFirstParTopPadding, - getProperty<table::BorderLine2>(xSet,"LeftBorder"), - getProperty<sal_Int32>(xSet,"LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"LeftBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"LeftBorderDistance")); // Right border (same as top border) - assertEqualBorder( - aFirstParTopBorder, aFirstParTopPadding, - getProperty<table::BorderLine2>(xSet,"RightBorder"), - getProperty<sal_Int32>(xSet,"RightBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,"RightBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,"RightBorderDistance")); // Shadow const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xSet,"ParaShadowFormat"); @@ -219,28 +211,20 @@ void Test::testCharacterBorder() uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY); // Top border - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharTopBorder"), - getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); // Bottom border (same as top border) - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharBottomBorder"), - getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); // Left border (same as top border) - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharLeftBorder"), - getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); // Right border (same as top border) - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharRightBorder"), - getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); // Shadow const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xSet,"CharShadowFormat"); @@ -259,28 +243,20 @@ void Test::testCharacterBorder() uno::Reference < beans::XPropertySet > xPSet( xAutoStylesEnum->nextElement(), uno::UNO_QUERY ); // Top border - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharTopBorder"), - getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharTopBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); // Bottom border - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharBottomBorder"), - getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharBottomBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); // Left border - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharLeftBorder"), - getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharLeftBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); // Right border - assertEqualBorder( - aFirstParCharTopBorder, aFirstParCharTopPadding, - getProperty<table::BorderLine2>(xSet,"CharRightBorder"), - getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,"CharRightBorder")); + CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); } } @@ -302,28 +278,20 @@ void Test::testCharacterBorder() uno::Reference < beans::XPropertySet > xSet( getRun(getParagraph(2),2), uno::UNO_QUERY ); // Top border - assertEqualBorder( - aBorderArray[0], aDistances[0], - getProperty<table::BorderLine2>(xSet,"CharTopBorder"), - getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[0], getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); // Bottom border - assertEqualBorder( - aBorderArray[1], aDistances[1], - getProperty<table::BorderLine2>(xSet,"CharBottomBorder"), - getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[1], getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); // Left border - assertEqualBorder( - aBorderArray[2], aDistances[2], - getProperty<table::BorderLine2>(xSet,"CharLeftBorder"), - getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[2], getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); // Right border - assertEqualBorder( - aBorderArray[3], aDistances[3], - getProperty<table::BorderLine2>(xSet,"CharRightBorder"), - getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[3], getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); // Shadow const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xSet,"CharShadowFormat"); @@ -338,28 +306,20 @@ void Test::testCharacterBorder() uno::Reference < beans::XPropertySet > xStyleSet(xStyleFamily->getByName("CharDiffBor"), uno::UNO_QUERY); // Top border - assertEqualBorder( - aBorderArray[0], aDistances[0], - getProperty<table::BorderLine2>(xStyleSet,"CharTopBorder"), - getProperty<sal_Int32>(xStyleSet,"CharTopBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[0], getProperty<table::BorderLine2>(xSet,"CharTopBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[0], getProperty<sal_Int32>(xSet,"CharTopBorderDistance")); // Bottom border - assertEqualBorder( - aBorderArray[1], aDistances[1], - getProperty<table::BorderLine2>(xStyleSet,"CharBottomBorder"), - getProperty<sal_Int32>(xStyleSet,"CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[1], getProperty<table::BorderLine2>(xSet,"CharBottomBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[1], getProperty<sal_Int32>(xSet,"CharBottomBorderDistance")); // Left border - assertEqualBorder( - aBorderArray[2], aDistances[2], - getProperty<table::BorderLine2>(xStyleSet,"CharLeftBorder"), - getProperty<sal_Int32>(xStyleSet,"CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[2], getProperty<table::BorderLine2>(xSet,"CharLeftBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[2], getProperty<sal_Int32>(xSet,"CharLeftBorderDistance")); // Right border - assertEqualBorder( - aBorderArray[3], aDistances[3], - getProperty<table::BorderLine2>(xStyleSet,"CharRightBorder"), - getProperty<sal_Int32>(xStyleSet,"CharRightBorderDistance")); + CPPUNIT_ASSERT_EQUAL_BORDER(aBorderArray[3], getProperty<table::BorderLine2>(xSet,"CharRightBorder")); + CPPUNIT_ASSERT_EQUAL(aDistances[3], getProperty<sal_Int32>(xSet,"CharRightBorderDistance")); } } } |