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/sheet/tableautoformat.hxx>
12 #include <com/sun/star/beans/XPropertySet.hpp>
13 #include <com/sun/star/uno/Any.hxx>
14 #include <com/sun/star/uno/Reference.hxx>
16 #include <cppunit/TestAssert.h>
18 using namespace com::sun::star
;
19 using namespace com::sun::star::uno
;
23 void TableAutoFormat::testTableAutoFormatProperties()
25 uno::Reference
<beans::XPropertySet
> xTableAutoFormat(init(), UNO_QUERY_THROW
);
29 propName
= "IncludeFont";
30 bool aIncludeFont
= false;
31 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont",
32 xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeFont
);
35 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
36 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeFont
);
37 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", !aIncludeFont
);
39 propName
= "IncludeJustify";
40 bool aIncludeJustify
= false;
41 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify",
42 xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeJustify
);
45 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
46 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeJustify
);
47 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", !aIncludeJustify
);
49 propName
= "IncludeBorder";
50 bool aIncludeBorder
= false;
51 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder",
52 xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeBorder
);
55 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
56 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeBorder
);
57 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", !aIncludeBorder
);
59 propName
= "IncludeBackground";
60 bool aIncludeBackground
= false;
61 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground",
62 xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeBackground
);
65 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
66 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeBackground
);
67 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", !aIncludeBackground
);
69 propName
= "IncludeNumberFormat";
70 bool aIncludeNumberFormat
= false;
71 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat",
72 xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeNumberFormat
);
75 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
76 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeNumberFormat
);
77 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat",
78 !aIncludeNumberFormat
);
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
);
87 xTableAutoFormat
->setPropertyValue(propName
, aNewValue
);
88 CPPUNIT_ASSERT(xTableAutoFormat
->getPropertyValue(propName
) >>= aIncludeWidthAndHeight
);
89 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeWidthAndHeight",
90 !aIncludeWidthAndHeight
);
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */