LibreOffice Module test (master)  1
xviewpane.cxx
Go to the documentation of this file.
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/xviewpane.hxx>
11 #include <com/sun/star/sheet/XViewPane.hpp>
12 #include <com/sun/star/table/CellRangeAddress.hpp>
13 
14 #include <cppunit/TestAssert.h>
15 
16 using namespace css;
17 using namespace css::uno;
18 
19 namespace apitest
20 {
21 void XViewPane::testFirstVisibleColumn()
22 {
23  sal_Int32 nCol = 5;
24  uno::Reference<sheet::XViewPane> xViewPane(init(), UNO_QUERY_THROW);
25  xViewPane->setFirstVisibleColumn(nCol);
26  CPPUNIT_ASSERT_EQUAL(xViewPane->getFirstVisibleColumn(), nCol);
27 }
28 
29 void XViewPane::testFirstVisibleRow()
30 {
31  sal_Int32 nRow = 3;
32  uno::Reference<sheet::XViewPane> xViewPane(init(), UNO_QUERY_THROW);
33  xViewPane->setFirstVisibleRow(nRow);
34  CPPUNIT_ASSERT_EQUAL(xViewPane->getFirstVisibleRow(), nRow);
35 }
36 
37 void XViewPane::testVisibleRange()
38 {
39  constexpr sal_Int32 nCol = 5;
40  constexpr sal_Int32 nRow = 3;
41  uno::Reference<sheet::XViewPane> xViewPane(init(), UNO_QUERY_THROW);
42  xViewPane->setFirstVisibleColumn(nCol);
43  xViewPane->setFirstVisibleRow(nRow);
44 
45  table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange();
46  CPPUNIT_ASSERT_EQUAL(short(0), aCellRangeAddress.Sheet);
47  CPPUNIT_ASSERT_EQUAL(nRow, aCellRangeAddress.StartRow);
48  CPPUNIT_ASSERT_EQUAL(nCol, aCellRangeAddress.StartColumn);
49 }
50 }
51 
52 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FILE * init(int, char **)