LibreOffice Module test (master)  1
cellproperties.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/beans/XPropertySet.hpp>
13 
14 #include <cppunit/TestAssert.h>
15 #include <iostream>
16 
17 using namespace css;
18 using namespace css::uno;
19 
20 namespace apitest
21 {
22 void CellProperties::testVertJustify()
23 {
24  uno::Reference<beans::XPropertySet> xCellRangeBase(init(), UNO_QUERY_THROW);
25  OUString aVertJustify("VertJustify");
26  uno::Any aOldVertJustify = xCellRangeBase->getPropertyValue(aVertJustify);
27  sal_Int32 aValue = 0;
28  CPPUNIT_ASSERT(aOldVertJustify >>= aValue);
29  std::cout << "Old VertJustify value: " << aValue << std::endl;
30 
31  uno::Any aNewVertJustify;
32  aNewVertJustify <<= static_cast<sal_Int32>(3);
33  xCellRangeBase->setPropertyValue(aVertJustify, aNewVertJustify);
34  uno::Any aVertJustifyControllValue = xCellRangeBase->getPropertyValue(aVertJustify);
35  CPPUNIT_ASSERT(aVertJustifyControllValue >>= aValue);
36  std::cout << "New VertJustify value: " << aValue << std::endl;
37  CPPUNIT_ASSERT_EQUAL_MESSAGE("value has not been changed", sal_Int32(3), aValue);
38 }
39 
40 void CellProperties::testRotateReference()
41 {
42  uno::Reference<beans::XPropertySet> xCellRangeBase(init(), UNO_QUERY_THROW);
43  OUString aRotateReference("RotateReference");
44  uno::Any aOldRotateReference = xCellRangeBase->getPropertyValue(aRotateReference);
45  sal_Int32 aValue = 0;
46  CPPUNIT_ASSERT(aOldRotateReference >>= aValue);
47  std::cout << "Old RotateReference Value: " << aValue << std::endl;
48 
49  uno::Any aNewRotateReference;
50  aNewRotateReference <<= static_cast<sal_Int32>(3);
51  xCellRangeBase->setPropertyValue(aRotateReference, aNewRotateReference);
52  uno::Any aRotateReferenceControllValue = xCellRangeBase->getPropertyValue(aRotateReference);
53  CPPUNIT_ASSERT(aRotateReferenceControllValue >>= aValue);
54  std::cout << "New RotateReference value: " << aValue << std::endl;
55  CPPUNIT_ASSERT_EQUAL_MESSAGE("value has not been changed", sal_Int32(3), aValue);
56 }
57 }
58 
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FILE * init(int, char **)