nss: upgrade to release 3.73
[LibreOffice.git] / test / source / sheet / documentsettings.cxx
blob644b7273c8b7f90155f95c11a4293cbd2e852536
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/documentsettings.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 DocumentSettings::testDocumentSettingsProperties()
25 uno::Reference<beans::XPropertySet> xDocumentSettings(init(), UNO_QUERY_THROW);
26 OUString propName;
27 uno::Any aNewValue;
29 propName = "ShowZeroValues";
30 bool aShowZeroValues = false;
31 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowZeroValues);
32 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowZeroValues", aShowZeroValues);
34 aNewValue <<= false;
35 xDocumentSettings->setPropertyValue(propName, aNewValue);
36 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowZeroValues);
37 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowZeroValues", !aShowZeroValues);
39 propName = "ShowNotes";
40 bool aShowNotes = false;
41 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowNotes);
42 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowNotes", aShowNotes);
44 aNewValue <<= false;
45 xDocumentSettings->setPropertyValue(propName, aNewValue);
46 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowNotes);
47 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowNotes", !aShowNotes);
49 propName = "ShowGrid";
50 bool aShowGrid = false;
51 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowGrid);
52 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowGrid", aShowGrid);
54 aNewValue <<= false;
55 xDocumentSettings->setPropertyValue(propName, aNewValue);
56 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowGrid);
57 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowGrid", !aShowGrid);
59 propName = "ShowPageBreaks";
60 bool aShowPageBreaks = false;
61 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowPageBreaks);
62 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowPageBreaks", aShowPageBreaks);
64 aNewValue <<= false;
65 xDocumentSettings->setPropertyValue(propName, aNewValue);
66 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowPageBreaks);
67 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowPageBreaks", !aShowPageBreaks);
69 propName = "HasColumnRowHeaders";
70 bool aHasColumnRowHeaders = false;
71 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders);
72 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasColumnRowHeaders", aHasColumnRowHeaders);
74 aNewValue <<= false;
75 xDocumentSettings->setPropertyValue(propName, aNewValue);
76 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders);
77 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasColumnRowHeaders",
78 !aHasColumnRowHeaders);
80 propName = "HasSheetTabs";
81 bool aHasSheetTabs = false;
82 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasSheetTabs);
83 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasSheetTabs", aHasSheetTabs);
85 aNewValue <<= false;
86 xDocumentSettings->setPropertyValue(propName, aNewValue);
87 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasSheetTabs);
88 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasSheetTabs", !aHasSheetTabs);
90 propName = "IsOutlineSymbolsSet";
91 bool aIsOutlineSymbolsSet = false;
92 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet);
93 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsOutlineSymbolsSet", aIsOutlineSymbolsSet);
95 aNewValue <<= false;
96 xDocumentSettings->setPropertyValue(propName, aNewValue);
97 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet);
98 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsOutlineSymbolsSet",
99 !aIsOutlineSymbolsSet);
101 propName = "IsSnapToRaster";
102 bool aIsSnapToRaster = true;
103 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsSnapToRaster);
104 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsSnapToRaster", !aIsSnapToRaster);
106 aNewValue <<= true;
107 xDocumentSettings->setPropertyValue(propName, aNewValue);
108 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsSnapToRaster);
109 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsSnapToRaster", aIsSnapToRaster);
111 propName = "RasterIsVisible";
112 bool aRasterIsVisible = true;
113 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterIsVisible);
114 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue RasterIsVisible", !aRasterIsVisible);
116 aNewValue <<= true;
117 xDocumentSettings->setPropertyValue(propName, aNewValue);
118 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterIsVisible);
119 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue RasterIsVisible", aRasterIsVisible);
121 propName = "RasterResolutionX";
122 sal_Int32 aRasterResolutionX = 0;
123 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionX);
124 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterResolutionX", sal_Int32(1270),
125 aRasterResolutionX);
127 aNewValue <<= sal_Int32(42);
128 xDocumentSettings->setPropertyValue(propName, aNewValue);
129 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionX);
130 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterResolutionX", sal_Int32(42),
131 aRasterResolutionX);
133 propName = "RasterResolutionY";
134 sal_Int32 aRasterResolutionY = 0;
135 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionY);
136 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterResolutionY", sal_Int32(1270),
137 aRasterResolutionY);
139 aNewValue <<= sal_Int32(42);
140 xDocumentSettings->setPropertyValue(propName, aNewValue);
141 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionY);
142 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterResolutionY", sal_Int32(42),
143 aRasterResolutionY);
145 propName = "RasterSubdivisionX";
146 sal_Int32 aRasterSubdivisionX = 0;
147 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionX);
148 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterSubdivisionX", sal_Int32(1),
149 aRasterSubdivisionX);
151 aNewValue <<= sal_Int32(42);
152 xDocumentSettings->setPropertyValue(propName, aNewValue);
153 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionX);
154 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterSubdivisionX", sal_Int32(42),
155 aRasterSubdivisionX);
157 propName = "RasterSubdivisionY";
158 sal_Int32 aRasterSubdivisionY = 0;
159 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionY);
160 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterSubdivisionY", sal_Int32(1),
161 aRasterSubdivisionY);
163 aNewValue <<= sal_Int32(42);
164 xDocumentSettings->setPropertyValue(propName, aNewValue);
165 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionY);
166 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterSubdivisionY", sal_Int32(42),
167 aRasterSubdivisionY);
169 propName = "IsRasterAxisSynchronized";
170 bool aIsRasterAxisSynchronized = false;
171 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsRasterAxisSynchronized);
172 CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsRasterAxisSynchronized",
173 aIsRasterAxisSynchronized);
175 aNewValue <<= false;
176 xDocumentSettings->setPropertyValue(propName, aNewValue);
177 CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsRasterAxisSynchronized);
178 CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsRasterAxisSynchronized",
179 !aIsRasterAxisSynchronized);
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */