12#include <com/sun/star/sheet/XCellSeries.hpp>
13#include <com/sun/star/table/XCellRange.hpp>
15#include <cppunit/TestAssert.h>
24 uno::Reference<table::XCellRange> xCellRange(
init(), UNO_QUERY_THROW);
28 uno::Reference<sheet::XCellSeries> xCellSeriesH(xCellRangeH, UNO_QUERY_THROW);
29 xCellSeriesH->fillAuto(sheet::FillDirection_TO_RIGHT, 1);
31 for(sal_Int32
i = 0;
i < 3;
i++) {
32 uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(
maStartX +
i,
maStartY), UNO_SET_THROW);
33 sumH += xCellResultH->getValue();
35 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillAuto with TO_RIGHT",
maValue * 3 + 3, sumH);
38 uno::Reference<sheet::XCellSeries> xCellSeriesV(xCellRangeV, UNO_QUERY_THROW);
39 xCellSeriesV->fillAuto(sheet::FillDirection_TO_BOTTOM, 1);
41 for(sal_Int32
i = 0;
i < 3;
i++) {
42 uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(
maStartX,
maStartY +
i), UNO_SET_THROW);
43 sumV += xCellResultV->getValue();
45 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillAuto with TO_BOTTOM",
maValue * 3 + 3, sumV);
47 for(sal_Int32
i = 1;
i < 3;
i++) {
48 uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(
maStartX +
i,
maStartY), UNO_SET_THROW);
49 xCellResultH->setFormula(
"");
50 uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(
maStartX,
maStartY +
i), UNO_SET_THROW);
51 xCellResultV->setFormula(
"");
57 uno::Reference<table::XCellRange> xCellRange(
init(), UNO_QUERY_THROW);
61 uno::Reference<sheet::XCellSeries> xCellSeriesH(xCellRangeH, UNO_QUERY_THROW);
62 xCellSeriesH->fillSeries(sheet::FillDirection_TO_RIGHT,
63 sheet::FillMode_LINEAR,
64 sheet::FillDateMode_FILL_DATE_DAY, 2, 1000);
66 for(sal_Int32
i = 0;
i < 3;
i++) {
67 uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(
maStartX +
i,
maStartY), UNO_SET_THROW);
68 sumH += xCellResultH->getValue();
70 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillSeries with TO_RIGHT and LINEAR",
maValue * 3 + 6, sumH);
72 xCellSeriesH->fillSeries(sheet::FillDirection_TO_RIGHT,
73 sheet::FillMode_GROWTH,
74 sheet::FillDateMode_FILL_DATE_DAY, 2, 1000);
76 for(sal_Int32
i = 0;
i < 3;
i++) {
77 uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(
maStartX +
i,
maStartY), UNO_SET_THROW);
78 sumH += xCellResultH->getValue();
80 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillSeries with TO_RIGHT and GROWTH",
maValue +
maValue * 2 +
maValue * 4, sumH);
83 uno::Reference<sheet::XCellSeries> xCellSeriesV(xCellRangeV, UNO_QUERY_THROW);
84 xCellSeriesV->fillSeries(sheet::FillDirection_TO_BOTTOM,
85 sheet::FillMode_LINEAR,
86 sheet::FillDateMode_FILL_DATE_DAY, 2, 1000);
88 for(sal_Int32
i = 0;
i < 3;
i++) {
89 uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(
maStartX,
maStartY +
i), UNO_SET_THROW);
90 sumV += xCellResultV->getValue();
92 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillSeries with TO_BOTTOM and LINEAR",
maValue * 3 + 6, sumV);
94 xCellSeriesV->fillSeries(sheet::FillDirection_TO_BOTTOM,
95 sheet::FillMode_GROWTH,
96 sheet::FillDateMode_FILL_DATE_DAY, 2, 1000);
98 for(sal_Int32
i = 0;
i < 3;
i++) {
99 uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(
maStartX,
maStartY +
i), UNO_SET_THROW);
100 sumV += xCellResultV->getValue();
102 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong result for fillSeries with TO_BOTTOM and GROWTH",
maValue +
maValue * 2 +
maValue * 4, sumV);
104 for(sal_Int32
i = 1;
i < 3;
i++) {
105 uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(
maStartX +
i,
maStartY), UNO_SET_THROW);
106 xCellResultH->setFormula(
"");
107 uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(
maStartX,
maStartY +
i), UNO_SET_THROW);
108 xCellResultV->setFormula(
"");
virtual css::uno::Reference< css::uno::XInterface > init()=0