summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-23 22:54:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-23 22:54:08 +0200
commit52a7238aedc157f47ed036d8c08b705464d13f6a (patch)
tree34e492e46e16853ea757565b4138a6d648301d8c /test
parentfe5fa933e2c237cf902e65de821b5aa29c56e9a7 (diff)
Improve test assertions
Change-Id: I5c5a76ca0e1db699dbb9f3fd381e050fc7256d27
Diffstat (limited to 'test')
-rw-r--r--test/source/sheet/xsheetannotations.cxx51
1 files changed, 38 insertions, 13 deletions
diff --git a/test/source/sheet/xsheetannotations.cxx b/test/source/sheet/xsheetannotations.cxx
index b4ae36ef8288..66715938163a 100644
--- a/test/source/sheet/xsheetannotations.cxx
+++ b/test/source/sheet/xsheetannotations.cxx
@@ -38,21 +38,30 @@ void XSheetAnnotations::testInsertNew()
//uno::Reference< container::XIndexAccess > xAnnotationsIndexAfter (aSheetAnnotations, UNO_QUERY_THROW);
sal_Int32 nAfter = xAnnotationsIndex->getCount();
- CPPUNIT_ASSERT_MESSAGE("Annotations index not updated", nAfter == nBefore + 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Annotations index not updated", nBefore + 1, nAfter);
// is the position ok ?
uno::Reference< sheet::XSheetAnnotation > aLastSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-1), UNO_QUERY_THROW);
table::CellAddress xResultCellAddress = aLastSheetAnnotation->getPosition();
- CPPUNIT_ASSERT_MESSAGE("Insert Annotation - Wrong SHEET reference position", xResultCellAddress.Sheet == xTargetCellAddress.Sheet);
- CPPUNIT_ASSERT_MESSAGE("Insert Annotation - Wrong COLUMN reference position", xResultCellAddress.Column == xTargetCellAddress.Column);
- CPPUNIT_ASSERT_MESSAGE("Insert Annotation - Wrong ROW reference position", xResultCellAddress.Row == xTargetCellAddress.Row);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Insert Annotation - Wrong SHEET reference position",
+ xTargetCellAddress.Sheet, xResultCellAddress.Sheet);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Insert Annotation - Wrong COLUMN reference position",
+ xTargetCellAddress.Column, xResultCellAddress.Column);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Insert Annotation - Wrong ROW reference position",
+ xTargetCellAddress.Row, xResultCellAddress.Row);
// is the string ok ?
uno::Reference< text::XTextRange > aTextSheetAnnotation(aLastSheetAnnotation, UNO_QUERY_THROW);
OUString aString = aTextSheetAnnotation->getString();
- CPPUNIT_ASSERT_MESSAGE("Insert Annotation - Wrong string", aString == "an inserted annotation");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Insert Annotation - Wrong string", OUString("an inserted annotation"),
+ aString);
}
@@ -83,29 +92,45 @@ void XSheetAnnotations::testRemoveByIndex()
uno::Reference< sheet::XSheetAnnotation > aLastSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-1), UNO_QUERY_THROW);
table::CellAddress xResultCellAddress = aLastSheetAnnotation->getPosition();
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong SHEET reference position", xResultCellAddress.Sheet == xOtherCellAddress.Sheet);
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong COLUMN reference position", xResultCellAddress.Column == xOtherCellAddress.Column);
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong ROW reference position", xResultCellAddress.Row == xOtherCellAddress.Row);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong SHEET reference position",
+ xOtherCellAddress.Sheet, xResultCellAddress.Sheet);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong COLUMN reference position",
+ xOtherCellAddress.Column, xResultCellAddress.Column);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong ROW reference position",
+ xOtherCellAddress.Row, xResultCellAddress.Row);
// is the string ok ?
uno::Reference< text::XTextRange > aLastTextSheetAnnotation(aLastSheetAnnotation, UNO_QUERY_THROW);
OUString aLastString = aLastTextSheetAnnotation->getString();
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong string", aLastString == "an inserted annotation 3");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong string",
+ OUString("an inserted annotation 3"), aLastString);
// the previous should be xTargetCellAddress
uno::Reference< sheet::XSheetAnnotation > aPreviousSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-2), UNO_QUERY_THROW);
table::CellAddress xPreviousCellAddress = aPreviousSheetAnnotation->getPosition();
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong SHEET reference position", xPreviousCellAddress.Sheet == xTargetCellAddress.Sheet);
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong COLUMN reference position", xPreviousCellAddress.Column == xTargetCellAddress.Column);
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong ROW reference position", xPreviousCellAddress.Row == xTargetCellAddress.Row);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong SHEET reference position",
+ xTargetCellAddress.Sheet, xPreviousCellAddress.Sheet);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong COLUMN reference position",
+ xTargetCellAddress.Column, xPreviousCellAddress.Column);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong ROW reference position",
+ xTargetCellAddress.Row, xPreviousCellAddress.Row);
// is the string ok ?
uno::Reference< text::XTextRange > aPreviousTextSheetAnnotation(aPreviousSheetAnnotation, UNO_QUERY_THROW);
OUString aPreviousString = aPreviousTextSheetAnnotation->getString();
- CPPUNIT_ASSERT_MESSAGE("Remove Annotation - Wrong string", aPreviousString == "an inserted annotation 1");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Remove Annotation - Wrong string",
+ OUString("an inserted annotation 1"), aPreviousString);
}