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/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
;
23 void Scenario::testScenarioProperties()
25 uno::Reference
<beans::XPropertySet
> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW
);
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
);
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),
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),
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
);
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
);
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
);
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
);
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
);
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
);
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: */