bump product version to 7.2.5.1
[LibreOffice.git] / test / source / sheet / cellarealink.cxx
blobbfaf4c3fe99be0c6c0c8c3fc6cabc2be9c69db8a
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.
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 */
10 #include <test/sheet/cellarealink.hxx>
12 #include <com/sun/star/beans/XPropertySet.hpp>
13 #include <com/sun/star/uno/Reference.hxx>
15 #include <cppunit/TestAssert.h>
17 using namespace css;
19 namespace apitest
21 void CellAreaLink::testUrl()
23 uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
25 static const OUStringLiteral propName(u"Url");
27 OUString aUrl;
28 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl);
29 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Url already changed", m_aFileURL, aUrl);
31 uno::Any aNewUrl;
32 aNewUrl <<= OUString("file:///tmp");
33 xCellAreaLink->setPropertyValue(propName, aNewUrl);
34 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl);
35 CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Url wasn't changed", OUString("file:///tmp"), aUrl);
38 void CellAreaLink::testFilter()
40 uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
42 static const OUStringLiteral propName(u"Filter");
44 OUString aFilter;
45 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter);
46 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Filter already changed", OUString("calc8"), aFilter);
48 uno::Any aNewFilter;
49 aNewFilter <<= OUString("UnitTest");
50 xCellAreaLink->setPropertyValue(propName, aNewFilter);
51 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter);
52 CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Filter wasn't changed", OUString("UnitTest"), aFilter);
55 void CellAreaLink::testFilterOptions()
57 uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
59 static const OUStringLiteral propName(u"FilterOptions");
61 OUString aFilterOptions;
62 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions);
63 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default FilterOptions already changed", OUString(""),
64 aFilterOptions);
66 uno::Any aNewFilterOptions;
67 aNewFilterOptions <<= OUString("UnitTest");
68 xCellAreaLink->setPropertyValue(propName, aNewFilterOptions);
69 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions);
70 CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of FilterOptions wasn't changed", OUString("UnitTest"),
71 aFilterOptions);
74 void CellAreaLink::testRefreshDelay()
76 uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
78 static const OUStringLiteral propName(u"RefreshDelay");
80 sal_Int32 aRefreshDelay = 0;
81 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay);
82 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshDelay already changed", sal_Int32(0),
83 aRefreshDelay);
85 uno::Any aNewRefreshDelay;
86 aNewRefreshDelay <<= static_cast<sal_Int32>(42);
87 xCellAreaLink->setPropertyValue(propName, aNewRefreshDelay);
88 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay);
89 CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of RefreshDelay wasn't changed", sal_Int32(42),
90 aRefreshDelay);
93 void CellAreaLink::testRefreshPeriod()
95 uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
97 static const OUStringLiteral propName(u"RefreshPeriod");
99 sal_Int32 aRefreshPeriod = 0;
100 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod);
101 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshPeriod already changed", sal_Int32(0),
102 aRefreshPeriod);
104 uno::Any aNewRefreshPeriod;
105 aNewRefreshPeriod <<= static_cast<sal_Int32>(42);
106 xCellAreaLink->setPropertyValue(propName, aNewRefreshPeriod);
107 CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod);
108 CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of RefreshPeriod wasn't changed", sal_Int32(42),
109 aRefreshPeriod);
112 } // namespace apitest
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */