Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 :
10 : #include <test/sheet/xsheetannotation.hxx>
11 :
12 : #include <com/sun/star/table/CellAddress.hpp>
13 :
14 : #include "cppunit/extensions/HelperMacros.h"
15 : #include <rtl/ustring.hxx>
16 :
17 : using namespace css;
18 : using namespace css::uno;
19 :
20 : namespace apitest {
21 :
22 0 : void XSheetAnnotation::testGetPosition()
23 : {
24 0 : uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
25 0 : table::CellAddress xResultCellAddress = aSheetAnnotation->getPosition();
26 :
27 : //expected result
28 0 : table::CellAddress xExpectedCellAddress;
29 0 : xExpectedCellAddress.Sheet = 0;
30 0 : xExpectedCellAddress.Row = 1;
31 0 : xExpectedCellAddress.Column = 2;
32 :
33 0 : CPPUNIT_ASSERT_MESSAGE("Wrong SHEET reference position", xResultCellAddress.Sheet == xExpectedCellAddress.Sheet);
34 0 : CPPUNIT_ASSERT_MESSAGE("Wrong COLUMN reference position", xResultCellAddress.Column == xExpectedCellAddress.Column);
35 0 : CPPUNIT_ASSERT_MESSAGE("Wrong ROW reference position", xResultCellAddress.Row == xExpectedCellAddress.Row);
36 0 : }
37 :
38 0 : void XSheetAnnotation::testGetAuthor()
39 : {
40 0 : uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
41 0 : OUString aAuthor = aSheetAnnotation->getAuthor();
42 :
43 0 : CPPUNIT_ASSERT_MESSAGE("Wrong author", aAuthor.equals("LG"));
44 0 : }
45 0 : void XSheetAnnotation::testGetDate()
46 : {
47 0 : uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
48 0 : OUString aDate = aSheetAnnotation->getDate();
49 :
50 0 : CPPUNIT_ASSERT_MESSAGE("Wrong date", aDate.equals("01/17/2013"));
51 0 : }
52 0 : void XSheetAnnotation::testGetIsVisible()
53 : {
54 0 : uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
55 0 : bool isVisible = aSheetAnnotation->getIsVisible();
56 :
57 0 : CPPUNIT_ASSERT_MESSAGE("Wrong visible state", isVisible == true);
58 0 : }
59 0 : void XSheetAnnotation::testSetIsVisible()
60 : {
61 0 : uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
62 0 : aSheetAnnotation->setIsVisible(false);
63 0 : bool isVisible = aSheetAnnotation->getIsVisible();
64 :
65 0 : CPPUNIT_ASSERT_MESSAGE("Visible state not changed", isVisible == false);
66 0 : }
67 :
68 0 : }
69 :
70 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|