LibreOffice Module test (master)  1
xsheetlinkable.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 
11 
12 #include <com/sun/star/sheet/SheetLinkMode.hpp>
13 #include <com/sun/star/sheet/XSheetLinkable.hpp>
14 #include <com/sun/star/uno/Reference.hxx>
15 
16 #include <cppunit/TestAssert.h>
17 
18 using namespace css;
19 using namespace css::uno;
20 
21 namespace apitest {
22 
23 void XSheetLinkable::testSheetLinkable()
24 {
25  uno::Reference< sheet::XSheetLinkable > xSheetLinkable(init(), UNO_QUERY_THROW);
26 
27  xSheetLinkable->link(getFileURL(), "Sheet1", "", "", sheet::SheetLinkMode_VALUE);
28  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link mode",
29  sheet::SheetLinkMode_VALUE, xSheetLinkable->getLinkMode());
30  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link URL",
31  getFileURL(), xSheetLinkable->getLinkUrl());
32  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get sheet name",
33  OUString("Sheet1"), xSheetLinkable->getLinkSheetName());
34 
35  xSheetLinkable->setLinkMode(sheet::SheetLinkMode_NONE);
36  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link mode",
37  sheet::SheetLinkMode_NONE, xSheetLinkable->getLinkMode());
38 
39  xSheetLinkable->setLinkSheetName("Sheet2");
40  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set sheet name",
41  OUString("Sheet2"), xSheetLinkable->getLinkSheetName());
42 
43  xSheetLinkable->setLinkUrl(getFileURL());
44  CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link URL",
45  getFileURL(), xSheetLinkable->getLinkUrl());
46 }
47 
48 }
49 
50 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FILE * init(int, char **)