bump product version to 7.2.5.1
[LibreOffice.git] / test / source / sheet / scenario.cxx
blobdc96e3cc32b6c33db67b701c6fa6ee1a44ef41b5
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.
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 */
10 #include <test/sheet/scenario.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;
21 namespace apitest
23 void Scenario::testScenarioProperties()
25 uno::Reference<beans::XPropertySet> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW);
26 OUString propName;
27 uno::Any aNewValue;
29 propName = "IsActive";
30 bool aIsActive = false;
31 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
32 CPPUNIT_ASSERT_MESSAGE("Unable to get property value IsActive", aIsActive);
34 aNewValue <<= false;
35 xScenario->setPropertyValue(propName, aNewValue);
36 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
37 CPPUNIT_ASSERT_MESSAGE("Unable to set property value IsActive", !aIsActive);
39 propName = "BorderColor";
40 sal_Int32 aBorderColor = 0;
41 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
42 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value BorderColor", sal_Int32(12632256),
43 aBorderColor);
45 aNewValue <<= sal_Int32(42);
46 xScenario->setPropertyValue(propName, aNewValue);
47 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
48 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value BorderColor", sal_Int32(42),
49 aBorderColor);
51 propName = "Protected";
52 bool aProtected = false;
53 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
54 CPPUNIT_ASSERT_MESSAGE("Unable to get property value Protected", aProtected);
56 aNewValue <<= false;
57 xScenario->setPropertyValue(propName, aNewValue);
58 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
59 CPPUNIT_ASSERT_MESSAGE("Unable to set property value Protected", !aProtected);
61 propName = "ShowBorder";
62 bool aShowBorder = false;
63 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
64 CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowBorder", aShowBorder);
66 aNewValue <<= false;
67 xScenario->setPropertyValue(propName, aNewValue);
68 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
69 CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowBorder", !aShowBorder);
71 propName = "PrintBorder";
72 bool aPrintBorder = false;
73 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
74 CPPUNIT_ASSERT_MESSAGE("Unable to get property value PrintBorder", aPrintBorder);
76 aNewValue <<= false;
77 xScenario->setPropertyValue(propName, aNewValue);
78 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
79 CPPUNIT_ASSERT_MESSAGE("Unable to set property value PrintBorder", !aPrintBorder);
81 propName = "CopyBack";
82 bool aCopyBack = false;
83 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
84 CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyBack", aCopyBack);
86 aNewValue <<= false;
87 xScenario->setPropertyValue(propName, aNewValue);
88 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
89 CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyBack", !aCopyBack);
91 propName = "CopyStyles";
92 bool aCopyStyles = true;
93 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
94 CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyStyles", !aCopyStyles);
96 aNewValue <<= true;
97 xScenario->setPropertyValue(propName, aNewValue);
98 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
99 CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyStyles", aCopyStyles);
101 propName = "CopyFormulas";
102 bool aCopyFormulas = false;
103 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
104 CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyFormulas", aCopyFormulas);
106 aNewValue <<= false;
107 xScenario->setPropertyValue(propName, aNewValue);
108 CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
109 CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyFormulas", !aCopyFormulas);
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */