From c103775cd15b658bf5db1bda081c1ba5bd653c2a Mon Sep 17 00:00:00 2001 From: Laurent Godard Date: Fri, 27 Jun 2014 17:09:15 +0200 Subject: correct XSheetAnnotations GetByIndex test for #fdo#80551 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the previous testGetCount test already added a note on sheet 2 testGetByIndex now works on sheet 3 Change-Id: I2cd49aa2bbf5c1b707287518e0f15088f3ee5ec0 Reviewed-on: https://gerrit.libreoffice.org/9938 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- test/source/sheet/xsheetannotations.cxx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/source/sheet/xsheetannotations.cxx b/test/source/sheet/xsheetannotations.cxx index 66a7b8dd1876..d6e521f7bef1 100644 --- a/test/source/sheet/xsheetannotations.cxx +++ b/test/source/sheet/xsheetannotations.cxx @@ -171,31 +171,32 @@ void XSheetAnnotations::testGetByIndex() table::CellAddress xThirdCellAddress0 (0,0,3); aSheet0Annotations->insertNew(xThirdCellAddress0, "an inserted annotation 3 on sheet 1"); - // insert annotations in second sheet - uno::Reference< sheet::XSheetAnnotations > aSheet1Annotations (getAnnotations(1), UNO_QUERY_THROW); - table::CellAddress xTargetCellAddress1 (1,4,5); - aSheet1Annotations->insertNew(xTargetCellAddress1, "an inserted annotation 1 on sheet 2"); - table::CellAddress xSecondTargetCellAddress1 (1,5,6); - aSheet1Annotations->insertNew(xSecondTargetCellAddress1, "an inserted annotation 2 on sheet 2"); - table::CellAddress xThirdCellAddress1 (1,7,8); - aSheet1Annotations->insertNew(xThirdCellAddress1, "an inserted annotation 3 on sheet 2"); + // insert annotations in third sheet + uno::Reference< sheet::XSheetAnnotations > aSheet2Annotations (getAnnotations(2), UNO_QUERY_THROW); + table::CellAddress xTargetCellAddress2 (2,4,5); + aSheet2Annotations->insertNew(xTargetCellAddress2, "an inserted annotation 1 on sheet 3"); + table::CellAddress xSecondTargetCellAddress2 (2,5,6); + aSheet2Annotations->insertNew(xSecondTargetCellAddress2, "an inserted annotation 2 on sheet 3"); + table::CellAddress xThirdCellAddress2 (2,7,8); + aSheet2Annotations->insertNew(xThirdCellAddress2, "an inserted annotation 3 on sheet 3"); // get second annotation for second sheet - uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (getAnnotations(1), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (getAnnotations(2), UNO_QUERY_THROW); uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); uno::Reference< sheet::XSheetAnnotation > aAnnotation (xAnnotationsIndex->getByIndex(1), UNO_QUERY_THROW); table::CellAddress xToBeAnalyzedCellAddress = aAnnotation->getPosition(); + // is the CellAddress ok ? CPPUNIT_ASSERT_EQUAL_MESSAGE( "GetByIndex Annotation - Wrong SHEET reference position", - xSecondTargetCellAddress1.Sheet, xToBeAnalyzedCellAddress.Sheet); + xSecondTargetCellAddress2.Sheet, xToBeAnalyzedCellAddress.Sheet); CPPUNIT_ASSERT_EQUAL_MESSAGE( "GetByIndex Annotation - Wrong COLUMN reference position", - xSecondTargetCellAddress1.Column, xToBeAnalyzedCellAddress.Column); + xSecondTargetCellAddress2.Column, xToBeAnalyzedCellAddress.Column); CPPUNIT_ASSERT_EQUAL_MESSAGE( "GetByIndex Annotation - Wrong ROW reference position", - xSecondTargetCellAddress1.Row, xToBeAnalyzedCellAddress.Row); + xSecondTargetCellAddress2.Row, xToBeAnalyzedCellAddress.Row); // is the string ok ? uno::Reference< text::XTextRange > aTextSheetAnnotation(aAnnotation, UNO_QUERY_THROW); @@ -203,8 +204,7 @@ void XSheetAnnotations::testGetByIndex() CPPUNIT_ASSERT_EQUAL_MESSAGE( "GetByIndex Annotation - Wrong string", - OUString("an inserted annotation 2 on sheet 2"), aString); - + OUString("an inserted annotation 2 on sheet 3"), aString); } } -- cgit