LibreOffice Module test (master)  1
xsheetannotationanchor.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
12 
13 #include <com/sun/star/sheet/XSheetAnnotation.hpp>
14 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
15 #include <com/sun/star/table/CellAddress.hpp>
16 #include <com/sun/star/uno/Reference.hxx>
17 
18 #include <cppunit/TestAssert.h>
19 
20 using namespace css;
21 using namespace css::uno;
22 
23 namespace apitest
24 {
25 void XSheetAnnotationAnchor::testGetAnnotation()
26 {
27  uno::Reference<sheet::XSheetAnnotationAnchor> xAnchor(init(), UNO_QUERY_THROW);
28  uno::Reference<sheet::XSheetAnnotation> xAnnotation(xAnchor->getAnnotation(), UNO_SET_THROW);
29  CPPUNIT_ASSERT_MESSAGE("Unable to get XSheetAnnotation", xAnnotation.is());
30 
31  CPPUNIT_ASSERT_MESSAGE("Unable to check: getAuthor()", xAnnotation->getAuthor().isEmpty());
32  CPPUNIT_ASSERT_MESSAGE("Unable to check: getDate()", !xAnnotation->getDate().isEmpty());
33  CPPUNIT_ASSERT_MESSAGE("Unable to check: getIsVisible()", !xAnnotation->getIsVisible());
34  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to check: getPosition()", table::CellAddress(0, 2, 3),
35  xAnnotation->getPosition());
36 
37  xAnnotation->setIsVisible(false);
38  CPPUNIT_ASSERT_MESSAGE("Unable to setIsVisible() to false", !xAnnotation->getIsVisible());
39  xAnnotation->setIsVisible(true);
40  CPPUNIT_ASSERT_MESSAGE("Unable to setIsVisible() to true", xAnnotation->getIsVisible());
41 }
42 }
43 
44 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
FILE * init(int, char **)