summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-18 09:33:35 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-22 07:38:37 +0100
commit33a193130f7643f5bab2c9369f5d700114c6fbee (patch)
tree9780e89910122224a6deff84411e005832564f41 /chart2
parent4141533a3fb984fbaefe87b15fceeda7f2082061 (diff)
tdf#133423 Add ODF import/export test
Change-Id: I147c0cbd0b19d13ba86c3aa42cfe03de5d24de88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111099 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx32
-rw-r--r--chart2/qa/extras/data/ods/moving-type.odsbin0 -> 29749 bytes
2 files changed, 32 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 309381d80224..bb9b04e559c3 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
#include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
@@ -45,6 +46,7 @@ public:
void testTrendline();
void testTrendlineOOXML();
void testTrendlineXLS();
+ void testMovingAverage();
void testStockChart();
void testBarChart();
void testCrosses();
@@ -194,6 +196,7 @@ public:
CPPUNIT_TEST(testTrendline);
CPPUNIT_TEST(testTrendlineOOXML);
CPPUNIT_TEST(testTrendlineXLS);
+ CPPUNIT_TEST(testMovingAverage);
CPPUNIT_TEST(testStockChart);
CPPUNIT_TEST(testBarChart);
CPPUNIT_TEST(testCrosses);
@@ -661,6 +664,35 @@ void Chart2ExportTest::testTrendlineXLS()
checkTrendlinesInChart(getChartDocFromSheet( 0, mxComponent));
}
+void Chart2ExportTest::testMovingAverage()
+{
+ mbSkipValidation = true;
+ load(u"/chart2/qa/extras/data/ods/", "moving-type.ods");
+ reload("calc8");
+
+ uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
+ CPPUNIT_ASSERT( xDataSeries.is() );
+
+ Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xDataSeries, UNO_QUERY );
+ CPPUNIT_ASSERT( xRegressionCurveContainer.is() );
+
+ Sequence< Reference< chart2::XRegressionCurve > > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xRegressionCurveSequence.getLength());
+
+ Reference<chart2::XRegressionCurve> xCurve = xRegressionCurveSequence[0];
+ CPPUNIT_ASSERT(xCurve.is());
+
+ Reference<XPropertySet> xProperties( xCurve , uno::UNO_QUERY );
+ CPPUNIT_ASSERT(xProperties.is());
+
+ sal_Int32 nMovingAverageType = 0;
+ xProperties->getPropertyValue("MovingAverageType") >>= nMovingAverageType;
+ CPPUNIT_ASSERT_EQUAL(chart2::MovingAverageType::Central, nMovingAverageType);
+}
+
void Chart2ExportTest::testStockChart()
{
/* For attached file Stock_Chart.docx, in chart1.xml,
diff --git a/chart2/qa/extras/data/ods/moving-type.ods b/chart2/qa/extras/data/ods/moving-type.ods
new file mode 100644
index 000000000000..8a8568cfa741
--- /dev/null
+++ b/chart2/qa/extras/data/ods/moving-type.ods
Binary files differ