diff options
author | Jens Carl <j.carl43@gmx.de> | 2017-08-25 06:02:55 +0000 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-08-27 09:52:14 +0200 |
commit | 829b73b1e9cb4ed11feeff428220a39f3b666214 (patch) | |
tree | f12eedcd7d3be1bb28b4d51569f97d90554512a8 /test/source | |
parent | c298f79083cb7e09dd389a353b7bb25e6f5f00b2 (diff) |
tdf#45904 Move _DataPilotItem Java tests to C++
Change-Id: Ia20630f4cc187bd6f1a47bb6d747fda3c8b39e86
Reviewed-on: https://gerrit.libreoffice.org/41551
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'test/source')
-rw-r--r-- | test/source/sheet/datapilotitem.cxx | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/source/sheet/datapilotitem.cxx b/test/source/sheet/datapilotitem.cxx new file mode 100644 index 000000000000..b03d35f119a0 --- /dev/null +++ b/test/source/sheet/datapilotitem.cxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <test/sheet/datapilotitem.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include "cppunit/extensions/HelperMacros.h" + +#include <iostream> +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void DataPilotItem::testProperties() +{ + uno::Reference< container::XIndexAccess > xIA(init(), UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xItem(xIA->getByIndex(0), UNO_QUERY_THROW); + + + const OUString propNameIS("IsHidden"); + + bool bIsHidden = true; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); + CPPUNIT_ASSERT_MESSAGE("Default IsHidden already changed", !bIsHidden); + + uno::Any aNewIsHidden; + aNewIsHidden <<= false; + xItem->setPropertyValue(propNameIS, aNewIsHidden); + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); + CPPUNIT_ASSERT_MESSAGE("Value of IsHidden wasn't changed", !bIsHidden); + + + const OUString propNameSD("ShowDetail"); + + bool bShowDetail = false; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail); + CPPUNIT_ASSERT_MESSAGE("Default ShowDetail already changed", bShowDetail); + + uno::Any aNewShowDetail; + aNewShowDetail <<= true; + xItem->setPropertyValue(propNameSD, aNewShowDetail); + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail); + CPPUNIT_ASSERT_MESSAGE("Value of ShowDetail wasn't changed", bShowDetail); + + + const OUString propNameP("Position"); + + sal_Int32 nPosition = 42; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Position already changed", sal_Int32(0), nPosition); + + // FIXME: This throws somehow a com.sun.star.lang.IllegalArgumentException + //uno::Any aNewPosition; + //aNewPosition <<= static_cast<sal_Int32>(42); + //xItem->setPropertyValue(propNameP, aNewPosition); + //CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Position wasn't changed", sal_Int32(42), nPosition); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |