1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/tableautoformatfield.hxx>
13 #include "cppunit/extensions/HelperMacros.h"
15 using namespace com::sun::star::uno
;
19 uno::Reference
< beans::XPropertySet
> TableAutoFormatField::initTest()
21 uno::Reference
< container::XIndexAccess
> xAutoFormatFields( getServiceFactory()->createInstance("com.sun.star.sheet.TableAutoFormats"), UNO_QUERY_THROW
);
22 CPPUNIT_ASSERT(xAutoFormatFields
.is());
23 uno::Reference
< container::XIndexAccess
> xIndex( xAutoFormatFields
->getByIndex(0), UNO_QUERY_THROW
);
24 CPPUNIT_ASSERT(xIndex
.is());
25 uno::Reference
< beans::XPropertySet
> xReturn( xIndex
->getByIndex(0), UNO_QUERY_THROW
);
26 CPPUNIT_ASSERT_MESSAGE("could not create table auto formats", xReturn
.is());
30 void TableAutoFormatField::testRotateReference()
32 uno::Reference
< beans::XPropertySet
> xTableAutoFormatField
= initTest();
33 OUString
aRotateReference("RotateReference");
34 uno::Any aOldRotateReference
= xTableAutoFormatField
->getPropertyValue(aRotateReference
);
36 CPPUNIT_ASSERT(aOldRotateReference
>>= aValue
);
37 std::cout
<< "Old RotateReferene Value: " << aValue
<< std::endl
;
39 uno::Any aNewRotateReference
;
40 aNewRotateReference
<<= static_cast<sal_Int32
>(3);
41 xTableAutoFormatField
->setPropertyValue(aRotateReference
, aNewRotateReference
);
42 uno::Any aRotateReferenceControllValue
= xTableAutoFormatField
->getPropertyValue(aRotateReference
);
43 CPPUNIT_ASSERT(aRotateReferenceControllValue
>>= aValue
);
44 std::cout
<< "New VertJustify value: " << aValue
<< std::endl
;
45 CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue
== 3);
48 void TableAutoFormatField::testVertJustify()
50 uno::Reference
< beans::XPropertySet
> xTableAutoFormatField
= initTest();
51 OUString
aVertJustify("VertJustify");
52 uno::Any aOldVertJustify
= xTableAutoFormatField
->getPropertyValue(aVertJustify
);
54 CPPUNIT_ASSERT(aOldVertJustify
>>= aValue
);
55 std::cout
<< "Old VertJustify value: " << aValue
<< std::endl
;
57 uno::Any aNewVertJustify
;
58 aNewVertJustify
<<= static_cast<sal_Int32
>(3);
59 xTableAutoFormatField
->setPropertyValue(aVertJustify
, aNewVertJustify
);
60 uno::Any aVertJustifyControllValue
= xTableAutoFormatField
->getPropertyValue(aVertJustify
);
61 CPPUNIT_ASSERT(aVertJustifyControllValue
>>= aValue
);
62 std::cout
<< "New VertJustify value: " << aValue
<< std::endl
;
63 CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue
== 3);
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */