summaryrefslogtreecommitdiff
path: root/test/source/sheet
diff options
context:
space:
mode:
authorLaurent Godard <lgodard.libre@laposte.net>2013-12-06 12:36:41 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-06 05:46:16 -0600
commitf992400f6fec9c0178bddb83dbc859848221b659 (patch)
tree8242b760051f0617850c70833e7cc21c9482fb59 /test/source/sheet
parentc2f5e09900561d417d53a74fd6bc189cb7d898e1 (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/source/sheet')
-rw-r--r--test/source/sheet/xsheetannotations.cxx24
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");