Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 :
10 : #include <test/calc_unoapi_test.hxx>
11 :
12 : #include <com/sun/star/beans/XPropertySet.hpp>
13 : #include <com/sun/star/sheet/XConditionalFormats.hpp>
14 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
15 : #include <com/sun/star/sheet/XSpreadsheet.hpp>
16 : #include <com/sun/star/table/CellAddress.hpp>
17 : #include <com/sun/star/sheet/DataBarAxis.hpp>
18 : #include <com/sun/star/sheet/XDataBarEntry.hpp>
19 : #include <com/sun/star/sheet/DataBarEntryType.hpp>
20 : #include <com/sun/star/sheet/ColorScaleEntryType.hpp>
21 : #include <com/sun/star/sheet/XColorScaleEntry.hpp>
22 : #include <unonames.hxx>
23 :
24 : using namespace css;
25 :
26 : namespace sc_apitest {
27 :
28 : #define NUMBER_OF_TESTS 5
29 :
30 14 : class ScConditionalFormatTest : public CalcUnoApiTest
31 : {
32 : public:
33 : ScConditionalFormatTest();
34 :
35 : virtual void setUp() SAL_OVERRIDE;
36 : virtual void tearDown() SAL_OVERRIDE;
37 :
38 : uno::Reference< uno::XInterface > init(sal_Int32 nIndex = 0);
39 : void testRequestCondFormatListFromSheet();
40 : void testCondFormatListProperties();
41 : void testCondFormatListFormats();
42 : void testCondFormatProperties();
43 : void testCondFormatXIndex();
44 : void testDataBarProperties();
45 : void testColorScaleProperties();
46 :
47 2 : CPPUNIT_TEST_SUITE(ScConditionalFormatTest);
48 1 : CPPUNIT_TEST(testRequestCondFormatListFromSheet);
49 1 : CPPUNIT_TEST(testCondFormatListProperties);
50 1 : CPPUNIT_TEST(testCondFormatListFormats);
51 1 : CPPUNIT_TEST(testCondFormatProperties);
52 1 : CPPUNIT_TEST(testCondFormatXIndex);
53 1 : CPPUNIT_TEST(testDataBarProperties);
54 1 : CPPUNIT_TEST(testColorScaleProperties);
55 5 : CPPUNIT_TEST_SUITE_END();
56 : private:
57 :
58 : static sal_Int32 nTest;
59 : static uno::Reference< lang::XComponent > mxComponent;
60 : };
61 :
62 : sal_Int32 ScConditionalFormatTest::nTest = 0;
63 1 : uno::Reference< lang::XComponent > ScConditionalFormatTest::mxComponent;
64 :
65 7 : ScConditionalFormatTest::ScConditionalFormatTest()
66 7 : : CalcUnoApiTest("sc/qa/extras/testdocuments/")
67 : {
68 7 : }
69 :
70 7 : uno::Reference< uno::XInterface > ScConditionalFormatTest::init(sal_Int32 nIndex)
71 : {
72 7 : if(!mxComponent.is())
73 : {
74 : // get the test file
75 2 : OUString aFileURL;
76 2 : createFileURL(OUString("new_cond_format_api.ods"), aFileURL);
77 2 : mxComponent = loadFromDesktop(aFileURL);
78 : }
79 7 : CPPUNIT_ASSERT_MESSAGE("Component not loaded", mxComponent.is());
80 :
81 : // get the first sheet
82 7 : uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
83 14 : uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), uno::UNO_QUERY_THROW);
84 14 : uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(nIndex), uno::UNO_QUERY_THROW);
85 :
86 14 : return xSheet;
87 : }
88 :
89 1 : void ScConditionalFormatTest::testRequestCondFormatListFromSheet()
90 : {
91 1 : uno::Reference<sheet::XSpreadsheet> xSheet(init(), uno::UNO_QUERY_THROW);
92 2 : uno::Reference<beans::XPropertySet> xProps(xSheet, uno::UNO_QUERY_THROW);
93 2 : uno::Any aAny = xProps->getPropertyValue("ConditionalFormats");
94 2 : uno::Reference<sheet::XConditionalFormats> xCondFormats;
95 1 : CPPUNIT_ASSERT(aAny >>= xCondFormats);
96 2 : CPPUNIT_ASSERT(xCondFormats.is());
97 1 : }
98 :
99 : namespace {
100 :
101 6 : uno::Reference<sheet::XConditionalFormats> getConditionalFormatList(uno::Reference<uno::XInterface> xInterface)
102 : {
103 6 : uno::Reference<sheet::XSpreadsheet> xSheet(xInterface, uno::UNO_QUERY_THROW);
104 12 : uno::Reference<beans::XPropertySet> xProps(xSheet, uno::UNO_QUERY_THROW);
105 12 : uno::Any aAny = xProps->getPropertyValue("ConditionalFormats");
106 6 : uno::Reference<sheet::XConditionalFormats> xCondFormats;
107 6 : CPPUNIT_ASSERT(aAny >>= xCondFormats);
108 6 : CPPUNIT_ASSERT(xCondFormats.is());
109 :
110 12 : return xCondFormats;
111 : }
112 :
113 : }
114 :
115 1 : void ScConditionalFormatTest::testCondFormatListProperties()
116 : {
117 : uno::Reference<sheet::XConditionalFormats> xCondFormat =
118 1 : getConditionalFormatList(init());
119 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormat->getLength());
120 1 : }
121 :
122 1 : void ScConditionalFormatTest::testCondFormatListFormats()
123 : {
124 : uno::Reference<sheet::XConditionalFormats> xCondFormatList =
125 1 : getConditionalFormatList(init());
126 :
127 : uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
128 2 : xCondFormatList->getConditionalFormats();
129 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormats.getLength());
130 5 : for (sal_Int32 i = 0, n = xCondFormats.getLength(); i < n; ++i)
131 : {
132 4 : CPPUNIT_ASSERT(xCondFormats[i].is());
133 1 : }
134 1 : }
135 :
136 1 : void ScConditionalFormatTest::testCondFormatProperties()
137 : {
138 : uno::Reference<sheet::XConditionalFormats> xCondFormatList =
139 1 : getConditionalFormatList(init(1));
140 :
141 : uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
142 2 : xCondFormatList->getConditionalFormats();
143 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xCondFormats.getLength());
144 :
145 2 : uno::Reference<sheet::XConditionalFormat> xCondFormat = xCondFormats[0];
146 1 : CPPUNIT_ASSERT(xCondFormat.is());
147 2 : uno::Reference<beans::XPropertySet> xPropSet(xCondFormat, uno::UNO_QUERY_THROW);
148 2 : uno::Any aAny = xPropSet->getPropertyValue("Range");
149 2 : uno::Reference<sheet::XSheetCellRanges> xCellRanges;
150 1 : CPPUNIT_ASSERT(aAny >>= xCellRanges);
151 1 : CPPUNIT_ASSERT(xCellRanges.is());
152 2 : uno::Sequence<table::CellRangeAddress> aRanges = xCellRanges->getRangeAddresses();
153 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRanges.getLength());
154 1 : table::CellRangeAddress aRange = aRanges[0];
155 1 : CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aRange.Sheet);
156 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aRange.StartColumn);
157 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aRange.StartRow);
158 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aRange.EndColumn);
159 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(16), aRange.EndRow);
160 1 : }
161 :
162 1 : void ScConditionalFormatTest::testCondFormatXIndex()
163 : {
164 : uno::Reference<sheet::XConditionalFormats> xCondFormatList =
165 1 : getConditionalFormatList(init(1));
166 :
167 : uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
168 2 : xCondFormatList->getConditionalFormats();
169 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xCondFormats.getLength());
170 :
171 2 : uno::Reference<sheet::XConditionalFormat> xCondFormat = xCondFormats[0];
172 1 : CPPUNIT_ASSERT(xCondFormat.is());
173 :
174 2 : uno::Type aType = xCondFormat->getElementType();
175 1 : CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.beans.XPropertySet"), aType.getTypeName());
176 :
177 1 : CPPUNIT_ASSERT(xCondFormat->hasElements());
178 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xCondFormat->getCount());
179 :
180 2 : uno::Any aAny = xCondFormat->getByIndex(0);
181 2 : CPPUNIT_ASSERT(aAny.hasValue());
182 1 : }
183 :
184 : namespace {
185 :
186 5 : void testAxisPosition(uno::Reference<beans::XPropertySet> xPropSet, sal_Int32 ePos)
187 : {
188 : sal_Int32 eAxisPos;
189 5 : uno::Any aAny = xPropSet->getPropertyValue("AxisPosition");
190 5 : CPPUNIT_ASSERT(aAny >>= eAxisPos);
191 5 : CPPUNIT_ASSERT_EQUAL(ePos, eAxisPos);
192 5 : }
193 :
194 5 : void testShowValue(uno::Reference<beans::XPropertySet> xPropSet, bool bShowVal)
195 : {
196 : bool bShow;
197 5 : uno::Any aAny = xPropSet->getPropertyValue("ShowValue");
198 5 : CPPUNIT_ASSERT(aAny >>= bShow);
199 5 : CPPUNIT_ASSERT_EQUAL(bShowVal, bShow);
200 5 : }
201 :
202 5 : void testUseGradient(uno::Reference<beans::XPropertySet> xPropSet, bool bUseGradient)
203 : {
204 : bool bGradient;
205 5 : uno::Any aAny = xPropSet->getPropertyValue("UseGradient");
206 5 : CPPUNIT_ASSERT(aAny >>= bGradient);
207 5 : CPPUNIT_ASSERT_EQUAL(bUseGradient, bGradient);
208 5 : }
209 :
210 5 : void testPositiveColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
211 : {
212 5 : sal_Int32 nColor = 0;
213 5 : uno::Any aAny = xPropSet->getPropertyValue("Color");
214 5 : CPPUNIT_ASSERT(aAny >>= nColor);
215 5 : CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
216 5 : }
217 :
218 5 : void testNegativeColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
219 : {
220 5 : sal_Int32 nColor = 0;
221 5 : uno::Any aAny = xPropSet->getPropertyValue("NegativeColor");
222 5 : CPPUNIT_ASSERT(aAny >>= nColor);
223 5 : CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
224 5 : }
225 :
226 5 : void testAxisColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
227 : {
228 5 : sal_Int32 nColor = 0;
229 5 : uno::Any aAny = xPropSet->getPropertyValue("AxisColor");
230 5 : CPPUNIT_ASSERT(aAny >>= nColor);
231 5 : CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
232 5 : }
233 :
234 8 : void testDataBarEntryValue(uno::Reference<sheet::XDataBarEntry> xEntry,
235 : const OUString& rExpectedValue, sal_Int32 nType)
236 : {
237 8 : switch (nType)
238 : {
239 : case sheet::DataBarEntryType::DATABAR_VALUE:
240 : case sheet::DataBarEntryType::DATABAR_PERCENT:
241 : case sheet::DataBarEntryType::DATABAR_PERCENTILE:
242 : case sheet::DataBarEntryType::DATABAR_FORMULA:
243 : {
244 3 : OUString aString = xEntry->getFormula();
245 3 : CPPUNIT_ASSERT_EQUAL(rExpectedValue, aString);
246 : }
247 3 : break;
248 : default:
249 5 : break;
250 : }
251 8 : }
252 :
253 4 : void testDataBarEntries(uno::Reference<beans::XPropertySet> xPropSet,
254 : const OUString& rExpectedMinString, sal_Int32 nExpectedMinType,
255 : const OUString& rExpectedMaxString, sal_Int32 nExpectedMaxType)
256 : {
257 4 : uno::Any aAny = xPropSet->getPropertyValue("DataBarEntries");
258 8 : uno::Sequence<uno::Reference<sheet::XDataBarEntry> > aEntries;
259 4 : CPPUNIT_ASSERT(aAny >>= aEntries);
260 :
261 4 : CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aEntries.getLength());
262 :
263 4 : sal_Int32 nMinType = aEntries[0]->getType();
264 4 : CPPUNIT_ASSERT_EQUAL(nExpectedMinType, nMinType);
265 :
266 4 : sal_Int32 nMaxType = aEntries[1]->getType();
267 4 : CPPUNIT_ASSERT_EQUAL(nExpectedMaxType, nMaxType);
268 :
269 4 : testDataBarEntryValue(aEntries[0], rExpectedMinString, nMinType);
270 8 : testDataBarEntryValue(aEntries[1], rExpectedMaxString, nMaxType);
271 4 : }
272 :
273 : }
274 :
275 1 : void ScConditionalFormatTest::testDataBarProperties()
276 : {
277 : uno::Reference<sheet::XConditionalFormats> xCondFormatList =
278 1 : getConditionalFormatList(init(2));
279 :
280 : uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
281 2 : xCondFormatList->getConditionalFormats();
282 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xCondFormats.getLength());
283 :
284 2 : uno::Reference<sheet::XConditionalFormat> xCondFormat = xCondFormats[0];
285 1 : CPPUNIT_ASSERT(xCondFormat.is());
286 :
287 2 : uno::Type aType = xCondFormat->getElementType();
288 1 : CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.beans.XPropertySet"), aType.getTypeName());
289 :
290 1 : CPPUNIT_ASSERT(xCondFormat->hasElements());
291 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xCondFormat->getCount());
292 :
293 2 : uno::Reference<beans::XPropertySet> xPropSet;
294 : {
295 1 : uno::Any aAny = xCondFormat->getByIndex(0);
296 1 : CPPUNIT_ASSERT(aAny.hasValue());
297 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
298 1 : testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_AUTOMATIC);
299 1 : testShowValue(xPropSet, true);
300 1 : testUseGradient(xPropSet, true);
301 1 : testPositiveColor(xPropSet, COL_LIGHTBLUE);
302 1 : testNegativeColor(xPropSet, COL_LIGHTRED);
303 1 : testAxisColor(xPropSet, COL_BLACK);
304 : testDataBarEntries(xPropSet, "", sheet::DataBarEntryType::DATABAR_AUTO,
305 1 : "", sheet::DataBarEntryType::DATABAR_MAX);
306 : }
307 : {
308 1 : uno::Any aAny = xCondFormat->getByIndex(1);
309 1 : CPPUNIT_ASSERT(aAny.hasValue());
310 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
311 1 : testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_AUTOMATIC);
312 1 : testShowValue(xPropSet, true);
313 1 : testUseGradient(xPropSet, true);
314 1 : testPositiveColor(xPropSet, COL_LIGHTBLUE);
315 1 : testNegativeColor(xPropSet, COL_LIGHTRED);
316 1 : testAxisColor(xPropSet, COL_BLACK);
317 : testDataBarEntries(xPropSet, "", sheet::DataBarEntryType::DATABAR_MIN,
318 1 : "90", sheet::DataBarEntryType::DATABAR_PERCENTILE);
319 : }
320 : {
321 1 : uno::Any aAny = xCondFormat->getByIndex(2);
322 1 : CPPUNIT_ASSERT(aAny.hasValue());
323 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
324 1 : testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_AUTOMATIC);
325 1 : testShowValue(xPropSet, true);
326 1 : testUseGradient(xPropSet, true);
327 1 : testPositiveColor(xPropSet, COL_LIGHTBLUE);
328 1 : testNegativeColor(xPropSet, COL_LIGHTRED);
329 1 : testAxisColor(xPropSet, COL_BLACK);
330 : testDataBarEntries(xPropSet, "2", sheet::DataBarEntryType::DATABAR_VALUE,
331 1 : "80", sheet::DataBarEntryType::DATABAR_PERCENT);
332 : }
333 : {
334 1 : uno::Any aAny = xCondFormat->getByIndex(3);
335 1 : CPPUNIT_ASSERT(aAny.hasValue());
336 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
337 1 : testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_AUTOMATIC);
338 1 : testShowValue(xPropSet, true);
339 1 : testUseGradient(xPropSet, true);
340 1 : testPositiveColor(xPropSet, COL_LIGHTBLUE);
341 1 : testNegativeColor(xPropSet, COL_LIGHTRED);
342 1 : testAxisColor(xPropSet, COL_BLACK);
343 : /*
344 : * TODO: implement FORMULA
345 : testDataBarEntries(xPropSet, "=A1", sheet::DataBarEntryType::DATABAR_FORMULA,
346 : "", sheet::DataBarEntryType::DATABAR_AUTO);
347 : */
348 : }
349 : {
350 1 : uno::Any aAny = xCondFormat->getByIndex(4);
351 1 : CPPUNIT_ASSERT(aAny.hasValue());
352 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
353 1 : testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_MIDDLE);
354 1 : testShowValue(xPropSet, true);
355 1 : testUseGradient(xPropSet, false);
356 1 : testPositiveColor(xPropSet, sal_uInt32(10092390));
357 1 : testNegativeColor(xPropSet, sal_uInt32(52428));
358 1 : testAxisColor(xPropSet, sal_uInt32(16777113));
359 : testDataBarEntries(xPropSet, "", sheet::DataBarEntryType::DATABAR_AUTO,
360 1 : "", sheet::DataBarEntryType::DATABAR_AUTO);
361 1 : }
362 1 : }
363 :
364 : namespace {
365 :
366 8 : void testColorScaleEntry(uno::Reference<sheet::XColorScaleEntry> xEntry,
367 : sal_Int32 nType, const OUString& rString, sal_uInt32 nColor)
368 : {
369 8 : CPPUNIT_ASSERT_EQUAL(nType, xEntry->getType());
370 8 : CPPUNIT_ASSERT_EQUAL(nColor, sal_uInt32(xEntry->getColor()));
371 8 : switch (nType)
372 : {
373 : case sheet::ColorScaleEntryType::COLORSCALE_VALUE:
374 : case sheet::ColorScaleEntryType::COLORSCALE_PERCENT:
375 : case sheet::ColorScaleEntryType::COLORSCALE_PERCENTILE:
376 : // case sheet::ColorScaleEntryType::COLORSCALE_FORMULA:
377 : {
378 5 : CPPUNIT_ASSERT_EQUAL(rString, xEntry->getFormula());
379 : }
380 5 : break;
381 : default:
382 3 : break;
383 : }
384 8 : }
385 :
386 3 : void testColorScaleEntries(uno::Reference<beans::XPropertySet> xPropSet, sal_Int32 nEntries,
387 : sal_Int32 nMinType, const OUString& rMinString, sal_uInt32 nMinColor,
388 : sal_Int32 nMediumType, const OUString& rMediumString, sal_uInt32 nMediumColor,
389 : sal_Int32 nMaxType, const OUString& rMaxString, sal_uInt32 nMaxColor)
390 : {
391 3 : uno::Any aAny = xPropSet->getPropertyValue("ColorScaleEntries");
392 3 : CPPUNIT_ASSERT(aAny.hasValue());
393 6 : uno::Sequence<uno::Reference<sheet::XColorScaleEntry> > aEntries;
394 3 : CPPUNIT_ASSERT(aAny >>= aEntries);
395 :
396 3 : CPPUNIT_ASSERT_EQUAL(nEntries, aEntries.getLength());
397 3 : testColorScaleEntry(aEntries[0], nMinType, rMinString, nMinColor);
398 3 : size_t nMaxEntry = 1;
399 3 : if (nEntries == 3)
400 : {
401 2 : nMaxEntry = 2;
402 2 : testColorScaleEntry(aEntries[1], nMediumType, rMediumString, nMediumColor);
403 : }
404 6 : testColorScaleEntry(aEntries[nMaxEntry], nMaxType, rMaxString, nMaxColor);
405 3 : }
406 :
407 : }
408 :
409 1 : void ScConditionalFormatTest::testColorScaleProperties()
410 : {
411 : uno::Reference<sheet::XConditionalFormats> xCondFormatList =
412 1 : getConditionalFormatList(init(3));
413 :
414 : uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
415 2 : xCondFormatList->getConditionalFormats();
416 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xCondFormats.getLength());
417 :
418 2 : uno::Reference<sheet::XConditionalFormat> xCondFormat = xCondFormats[0];
419 1 : CPPUNIT_ASSERT(xCondFormat.is());
420 :
421 2 : uno::Type aType = xCondFormat->getElementType();
422 1 : CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.beans.XPropertySet"), aType.getTypeName());
423 :
424 1 : CPPUNIT_ASSERT(xCondFormat->hasElements());
425 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xCondFormat->getCount());
426 :
427 2 : uno::Reference<beans::XPropertySet> xPropSet;
428 : {
429 1 : uno::Any aAny = xCondFormat->getByIndex(0);
430 1 : CPPUNIT_ASSERT(aAny.hasValue());
431 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
432 : testColorScaleEntries(xPropSet, 3, sheet::ColorScaleEntryType::COLORSCALE_MIN, "", sal_uInt32(16777113),
433 : sheet::ColorScaleEntryType::COLORSCALE_PERCENTILE, "50", sal_uInt32(16737792),
434 1 : sheet::ColorScaleEntryType::COLORSCALE_MAX, "", sal_uInt32(16724787));
435 : }
436 : {
437 1 : uno::Any aAny = xCondFormat->getByIndex(1);
438 1 : CPPUNIT_ASSERT(aAny.hasValue());
439 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
440 : testColorScaleEntries(xPropSet, 3, sheet::ColorScaleEntryType::COLORSCALE_VALUE, "0", sal_uInt32(16711680),
441 : sheet::ColorScaleEntryType::COLORSCALE_PERCENTILE, "50", sal_uInt32(10092390),
442 1 : sheet::ColorScaleEntryType::COLORSCALE_PERCENT, "90", sal_uInt32(255));
443 : }
444 : {
445 1 : uno::Any aAny = xCondFormat->getByIndex(2);
446 1 : CPPUNIT_ASSERT(aAny.hasValue());
447 1 : CPPUNIT_ASSERT(aAny >>= xPropSet);
448 : testColorScaleEntries(xPropSet, 2, sheet::ColorScaleEntryType::COLORSCALE_FORMULA, "=A1", COL_WHITE,
449 : sheet::ColorScaleEntryType::COLORSCALE_PERCENTILE, "not used", sal_uInt32(1),
450 1 : sheet::ColorScaleEntryType::COLORSCALE_VALUE, "10", COL_BLACK);
451 1 : }
452 1 : }
453 :
454 7 : void ScConditionalFormatTest::setUp()
455 : {
456 7 : nTest++;
457 7 : CalcUnoApiTest::setUp();
458 7 : }
459 :
460 7 : void ScConditionalFormatTest::tearDown()
461 : {
462 7 : if (nTest == NUMBER_OF_TESTS)
463 : {
464 1 : closeDocument(mxComponent);
465 1 : mxComponent.clear();
466 : }
467 :
468 7 : CalcUnoApiTest::tearDown();
469 7 : }
470 :
471 1 : CPPUNIT_TEST_SUITE_REGISTRATION(ScConditionalFormatTest);
472 :
473 : }
474 :
475 4 : CPPUNIT_PLUGIN_IMPLEMENT();
476 :
477 :
478 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|