[Libreoffice-commits] core.git: chart2/qa

Tamás Zolnai tamas.zolnai at collabora.com
Wed Feb 15 21:28:32 UTC 2017


 chart2/qa/extras/chart2dump/chart2dump.cxx                                         |   64 ++++++++++
 chart2/qa/extras/chart2dump/data/normal_area_chart.ods                             |binary
 chart2/qa/extras/chart2dump/data/percent_stacked_area_chart.ods                    |binary
 chart2/qa/extras/chart2dump/data/stacked_area_chart.ods                            |binary
 chart2/qa/extras/chart2dump/reference/areacharttest/normal_area_chart.txt          |   62 +++++++++
 chart2/qa/extras/chart2dump/reference/areacharttest/percent_stacked_area_chart.txt |   62 +++++++++
 chart2/qa/extras/chart2dump/reference/areacharttest/stacked_area_chart.txt         |   62 +++++++++
 7 files changed, 250 insertions(+)

New commits:
commit d007cef2dfd0c4d7b009b4f943464c6c4854d88d
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Wed Feb 15 18:56:39 2017 +0100

    ChartDumpTest: Test area charts
    
    Change-Id: Ie6dbc4a005f1840dc6b324a99406283676580b96
    Reviewed-on: https://gerrit.libreoffice.org/34315
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 049a7cf..ba1d83b 100755
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -937,6 +937,70 @@ DECLARE_DUMP_TEST(PieChartTest, Chart2DumpTest, false)
     }
 }
 
+DECLARE_DUMP_TEST(AreaChartTest, Chart2DumpTest, false)
+{
+    const std::vector<OUString> aTestFiles =
+    {
+        "normal_area_chart.ods",
+        "stacked_area_chart.ods",
+        "percent_stacked_area_chart.ods"
+    };
+
+    for (const OUString& sTestFile : aTestFiles)
+    {
+        setTestFileName(sTestFile);
+        load(getTestFileDirName(), getTestFileName());
+        uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromSheet(0, mxComponent), UNO_QUERY_THROW);
+        uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
+        uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+        uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xShapes.is());
+
+        uno::Reference< chart2::XChartDocument > xChartDoc2(xChartDoc, UNO_QUERY_THROW);
+        Reference<chart2::XChartType> xChartType = getChartTypeFromDoc(xChartDoc2, 0);
+        CPPUNIT_ASSERT(xChartType.is());
+
+        std::vector<std::vector<double> > aDataSeriesYValues = getDataSeriesYValuesFromChartType(xChartType);
+        size_t nSeriesCount = aDataSeriesYValues.size();
+        CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(nSeriesCount);
+
+        for (size_t nSeries = 0; nSeries < nSeriesCount; ++nSeries)
+        {
+            uno::Reference<drawing::XShape> xSeries = getShapeByName(xShapes, "CID/D=0:CS=0:CT=0:Series=" + OUString::number(nSeries));
+            CPPUNIT_ASSERT(xSeries.is());
+            CPPUNIT_DUMP_ASSERT_NOTE("Series " + OUString::number(nSeries));
+
+            // One are for one series
+            uno::Reference<container::XIndexAccess> xIndexAccess(xSeries, UNO_QUERY_THROW);
+            uno::Reference<container::XIndexAccess> xIndexAccess2(xIndexAccess->getByIndex(0), UNO_QUERY_THROW); // Why this second group shape is here?
+            uno::Reference<drawing::XShape> xArea(xIndexAccess2->getByIndex(0), UNO_QUERY_THROW);
+
+            // Check size and position
+            awt::Point aAreaPosition = xArea->getPosition();
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAreaPosition.X, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAreaPosition.Y, INT_EPS);
+            awt::Size aAreaSize = xArea->getSize();
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAreaSize.Height, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAreaSize.Width, INT_EPS);
+
+            // Check transformation
+            Reference< beans::XPropertySet > xPropSet(xArea, UNO_QUERY_THROW);
+            CPPUNIT_ASSERT(xPropSet.is());
+            drawing::HomogenMatrix3 aAreaTransformation;
+            xPropSet->getPropertyValue("Transformation") >>= aAreaTransformation;
+            CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aAreaTransformation);
+
+            // Check area fill style and color
+            drawing::FillStyle aAreaFillStyle;
+            xPropSet->getPropertyValue(UNO_NAME_FILLSTYLE) >>= aAreaFillStyle;
+            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aAreaFillStyle));
+            util::Color aAreaFillColor = 0;
+            xPropSet->getPropertyValue(UNO_NAME_FILLCOLOR) >>= aAreaFillColor;
+            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aAreaFillColor));
+        }
+    }
+}
+
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/chart2/qa/extras/chart2dump/data/normal_area_chart.ods b/chart2/qa/extras/chart2dump/data/normal_area_chart.ods
new file mode 100755
index 0000000..84b9ec2
Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/normal_area_chart.ods differ
diff --git a/chart2/qa/extras/chart2dump/data/percent_stacked_area_chart.ods b/chart2/qa/extras/chart2dump/data/percent_stacked_area_chart.ods
new file mode 100755
index 0000000..0cc5d17
Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/percent_stacked_area_chart.ods differ
diff --git a/chart2/qa/extras/chart2dump/data/stacked_area_chart.ods b/chart2/qa/extras/chart2dump/data/stacked_area_chart.ods
new file mode 100755
index 0000000..56bc4e4
Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/stacked_area_chart.ods differ
diff --git a/chart2/qa/extras/chart2dump/reference/areacharttest/normal_area_chart.txt b/chart2/qa/extras/chart2dump/reference/areacharttest/normal_area_chart.txt
new file mode 100755
index 0000000..4f4a518
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/areacharttest/normal_area_chart.txt
@@ -0,0 +1,62 @@
+// nSeriesCount
+4
+/// Series 0
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+3295
+// aAreaSize.Height
+4052
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;4052;3295;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+1
+// static_cast<sal_Int32>(aAreaFillColor)
+16711680
+/// Series 1
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+3385
+// aAreaSize.Height
+3962
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;3962;3385;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+2
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 2
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+3345
+// aAreaSize.Height
+4002
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;4002;3345;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+4
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 3
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+2334
+// aAreaSize.Height
+5013
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;5013;2334;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+3
+// static_cast<sal_Int32>(aAreaFillColor)
+16777215
diff --git a/chart2/qa/extras/chart2dump/reference/areacharttest/percent_stacked_area_chart.txt b/chart2/qa/extras/chart2dump/reference/areacharttest/percent_stacked_area_chart.txt
new file mode 100755
index 0000000..b8769b7
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/areacharttest/percent_stacked_area_chart.txt
@@ -0,0 +1,62 @@
+// nSeriesCount
+4
+/// Series 0
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+5080
+// aAreaSize.Height
+2267
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;2267;5080;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+1
+// static_cast<sal_Int32>(aAreaFillColor)
+16711680
+/// Series 1
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+3458
+// aAreaSize.Height
+2693
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;2693;3458;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+2
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 2
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+2634
+// aAreaSize.Height
+2049
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;2049;2634;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+4
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 3
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+1344
+// aAreaSize.Height
+2157
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;2157;1344;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+3
+// static_cast<sal_Int32>(aAreaFillColor)
+16777215
diff --git a/chart2/qa/extras/chart2dump/reference/areacharttest/stacked_area_chart.txt b/chart2/qa/extras/chart2dump/reference/areacharttest/stacked_area_chart.txt
new file mode 100755
index 0000000..00934b4
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/areacharttest/stacked_area_chart.txt
@@ -0,0 +1,62 @@
+// nSeriesCount
+4
+/// Series 0
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+5958
+// aAreaSize.Height
+1389
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;1389;5958;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+1
+// static_cast<sal_Int32>(aAreaFillColor)
+16711680
+/// Series 1
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+4882
+// aAreaSize.Height
+1710
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;1710;4882;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+2
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 2
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+3510
+// aAreaSize.Height
+2542
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;2542;3510;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+4
+// static_cast<sal_Int32>(aAreaFillColor)
+10079487
+/// Series 3
+// aAreaPosition.X
+5507
+// aAreaPosition.Y
+1792
+// aAreaSize.Height
+3985
+// aAreaSize.Width
+11328
+// aAreaTransformation
+11328;0;5507;0;3985;1792;0;0;1
+// static_cast<sal_Int32>(aAreaFillStyle)
+3
+// static_cast<sal_Int32>(aAreaFillColor)
+16777215


More information about the Libreoffice-commits mailing list