1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <test/sheet/datapilotitem.hxx>
12 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/uno/Reference.hxx>
16 #include <cppunit/TestAssert.h>
18 using namespace com::sun::star
;
19 using namespace com::sun::star::uno
;
23 void DataPilotItem::testProperties()
25 uno::Reference
<beans::XPropertySet
> xItem(init(), UNO_QUERY_THROW
);
27 const OUString
propNameIS("IsHidden");
29 bool bIsHidden
= true;
30 CPPUNIT_ASSERT(xItem
->getPropertyValue(propNameIS
) >>= bIsHidden
);
31 CPPUNIT_ASSERT_MESSAGE("Default IsHidden already changed", !bIsHidden
);
33 uno::Any aNewIsHidden
;
34 aNewIsHidden
<<= false;
35 xItem
->setPropertyValue(propNameIS
, aNewIsHidden
);
36 CPPUNIT_ASSERT(xItem
->getPropertyValue(propNameIS
) >>= bIsHidden
);
37 CPPUNIT_ASSERT_MESSAGE("Value of IsHidden wasn't changed", !bIsHidden
);
39 const OUString
propNameSD("ShowDetail");
41 bool bShowDetail
= false;
42 CPPUNIT_ASSERT(xItem
->getPropertyValue(propNameSD
) >>= bShowDetail
);
43 CPPUNIT_ASSERT_MESSAGE("Default ShowDetail already changed", bShowDetail
);
45 uno::Any aNewShowDetail
;
46 aNewShowDetail
<<= true;
47 xItem
->setPropertyValue(propNameSD
, aNewShowDetail
);
48 CPPUNIT_ASSERT(xItem
->getPropertyValue(propNameSD
) >>= bShowDetail
);
49 CPPUNIT_ASSERT_MESSAGE("Value of ShowDetail wasn't changed", bShowDetail
);
51 sal_Int32 nPosition
= 42;
52 CPPUNIT_ASSERT(xItem
->getPropertyValue("Position") >>= nPosition
);
53 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Position already changed", sal_Int32(0), nPosition
);
55 // FIXME: This throws somehow a com.sun.star.lang.IllegalArgumentException
56 //uno::Any aNewPosition;
57 //aNewPosition <<= static_cast<sal_Int32>(42);
58 //xItem->setPropertyValue(propNameP, aNewPosition);
59 //CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition);
60 //CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Position wasn't changed", sal_Int32(42), nPosition);
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */