diff options
author | Laurent Godard <lgodard.libre@laposte.net> | 2013-12-06 12:36:41 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-12-18 12:42:23 +0100 |
commit | 2279208fa0570ef5fa2d49c14a721b7d59be069d (patch) | |
tree | 7668f93119da85c3abef9d54b431cd2c91fa4d5b /test | |
parent | 30b34a5dfde0a976c611b32ae1058412395f5bf3 (diff) |
count notes - GetNotesInRange now include last tab
- refactor tests
- add unit test on counting notes on a sheet
Change-Id: I6762a0e791a745b828800645effdfc044ac33710
Reviewed-on: https://gerrit.libreoffice.org/6954
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/sheet/xsheetannotations.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/source/sheet/xsheetannotations.cxx b/test/source/sheet/xsheetannotations.cxx index 66715938163a..a56fc6ba581c 100644 --- a/test/source/sheet/xsheetannotations.cxx +++ b/test/source/sheet/xsheetannotations.cxx @@ -22,6 +22,27 @@ using namespace css::uno; namespace apitest { +void XSheetAnnotations::testCount() +{ + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (init(), UNO_QUERY_THROW); + + // count on sheet 1 before inserting + uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nBefore = xAnnotationsIndex->getCount(); + + // get Sheet 2 annotations + uno::Reference< sheet::XSheetAnnotations > xSheet2Annotations( getAnnotations(1), UNO_QUERY_THROW); + + // insert a note on sheet 2 + table::CellAddress xTargetCellAddress (1,0,0); + xSheet2Annotations->insertNew(xTargetCellAddress, "an inserted annotation on sheet 2"); + + // count again on sheet 1 + sal_Int32 nAfter = xAnnotationsIndex->getCount(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Annotations count should not change on sheet 1", nBefore, nAfter); +} + void XSheetAnnotations::testInsertNew() { uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (init(), UNO_QUERY_THROW); @@ -30,6 +51,9 @@ void XSheetAnnotations::testInsertNew() uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); sal_Int32 nBefore = xAnnotationsIndex->getCount(); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "There should already be one note", 1, nBefore ); + // insert the annotation table::CellAddress xTargetCellAddress (0,3,4); aSheetAnnotations->insertNew(xTargetCellAddress, "an inserted annotation"); |