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/table/tablecolumn.hxx>
11 #include <test/unoapi_property_testers.hxx>
12 #include <comphelper/types.hxx>
13 #include <rtl/ustring.hxx>
15 #include <com/sun/star/beans/XPropertySet.hpp>
16 #include <com/sun/star/table/XCellRange.hpp>
18 #include <com/sun/star/uno/Any.hxx>
19 #include <com/sun/star/uno/Reference.hxx>
21 #include <cppunit/TestAssert.h>
27 void TableColumn::testTableColumnProperties()
29 uno::Reference
<beans::XPropertySet
> xPS(init(), uno::UNO_QUERY_THROW
);
31 OUString aPropName
= u
"Width"_ustr
;
32 testLongProperty(xPS
, aPropName
);
34 // currently changing the value to false has no effect
35 aPropName
= "OptimalWidth";
36 uno::Reference
<table::XCellRange
> xCR(m_xSheet
, uno::UNO_QUERY_THROW
);
37 xCR
->getCellByPosition(0, 0)->setFormula(u
"That's a pretty long text."_ustr
);
38 const sal_Int64 nWidthBefore
= ::comphelper::getINT64(xPS
->getPropertyValue(u
"Width"_ustr
));
39 xPS
->setPropertyValue(aPropName
, uno::Any(true));
40 CPPUNIT_ASSERT(::comphelper::getBOOL(xPS
->getPropertyValue(aPropName
)));
41 const sal_Int64 nWidthAfter
= ::comphelper::getINT64(xPS
->getPropertyValue(u
"Width"_ustr
));
42 CPPUNIT_ASSERT(nWidthBefore
!= nWidthAfter
);
44 aPropName
= "IsVisible";
45 testBooleanProperty(xPS
, aPropName
);
47 aPropName
= "IsStartOfNewPage";
48 testBooleanProperty(xPS
, aPropName
);
51 } // namespace apitest
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */