LibreOffice Module test (master) 1
tableautoformat.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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#include <com/sun/star/uno/Any.hxx>
14#include <com/sun/star/uno/Reference.hxx>
15
16#include <cppunit/TestAssert.h>
17
18using namespace com::sun::star;
19using namespace com::sun::star::uno;
20
21namespace apitest
22{
24{
25 uno::Reference<beans::XPropertySet> xTableAutoFormat(init(), UNO_QUERY_THROW);
26 OUString propName;
27 uno::Any aNewValue;
28
29 propName = "IncludeFont";
30 bool aIncludeFont = false;
31 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont",
32 xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
33
34 aNewValue <<= false;
35 xTableAutoFormat->setPropertyValue(propName, aNewValue);
36 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
37 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", !aIncludeFont);
38
39 propName = "IncludeJustify";
40 bool aIncludeJustify = false;
41 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify",
42 xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
43
44 aNewValue <<= false;
45 xTableAutoFormat->setPropertyValue(propName, aNewValue);
46 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
47 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", !aIncludeJustify);
48
49 propName = "IncludeBorder";
50 bool aIncludeBorder = false;
51 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder",
52 xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
53
54 aNewValue <<= false;
55 xTableAutoFormat->setPropertyValue(propName, aNewValue);
56 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
57 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", !aIncludeBorder);
58
59 propName = "IncludeBackground";
60 bool aIncludeBackground = false;
61 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground",
62 xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
63
64 aNewValue <<= false;
65 xTableAutoFormat->setPropertyValue(propName, aNewValue);
66 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
67 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", !aIncludeBackground);
68
69 propName = "IncludeNumberFormat";
70 bool aIncludeNumberFormat = false;
71 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat",
72 xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
73
74 aNewValue <<= false;
75 xTableAutoFormat->setPropertyValue(propName, aNewValue);
76 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
77 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat",
78 !aIncludeNumberFormat);
79
80 propName = "IncludeWidthAndHeight";
81 bool aIncludeWidthAndHeight = false;
82 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
83 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeWidthAndHeight",
84 aIncludeWidthAndHeight);
85
86 aNewValue <<= false;
87 xTableAutoFormat->setPropertyValue(propName, aNewValue);
88 CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
89 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeWidthAndHeight",
90 !aIncludeWidthAndHeight);
91}
92}
93
94/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
virtual css::uno::Reference< css::uno::XInterface > init()=0