chart2/qa/extras/chart2import.cxx            |   15 +++++++++++++++
 chart2/qa/extras/data/pptx/tdf127720.pptx    |binary
 chart2/source/tools/InternalDataProvider.cxx |    3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit dfd0717b3f55eeb15a5634e52d7d0ed544d17578
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Wed Feb 23 20:45:04 2022 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Feb 23 20:52:31 2022 +0100

    tdf#127720 chart2: create new columns for error bars
    
    This is basically a copy/paste of the bubble chart fix
    for tdf#103984 against the same LO 4.4 regression.
    
    No exist unit tests had error bars. Very interesting.
    
    make CppunitTest_chart2_import CPPUNIT_TEST_NAME=testPPTXChartErrorBars
    
    Change-Id: I81ff91ee2ba75277502a8e261106bf5837a8903b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130444
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 0c129d26978b..70cb393ba7b6 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -50,6 +50,7 @@ public:
     void testDOCXChartSeries();
     void testDOCXChartEmptySeries();
     void testTdf81396();
+    void testPPTXChartErrorBars();
     void testDOCXChartValuesSize();
     void testPPTXChartSeries();
     void testPPTXSparseChartSeries();
@@ -147,6 +148,7 @@ public:
     CPPUNIT_TEST(testDOCXChartSeries);
     CPPUNIT_TEST(testDOCXChartEmptySeries);
     CPPUNIT_TEST(testTdf81396);
+    CPPUNIT_TEST(testPPTXChartErrorBars);
     CPPUNIT_TEST(testDOCXChartValuesSize);
     CPPUNIT_TEST(testPPTChartSeries);
     CPPUNIT_TEST(testPPTXChartSeries);
@@ -481,6 +483,19 @@ void Chart2ImportTest::testTdf81396()
     CPPUNIT_ASSERT_EQUAL(105.210801910481, aDataSeriesYValues[0][0]);
 }
 
+void Chart2ImportTest::testPPTXChartErrorBars()
+{
+    load(u"/chart2/qa/extras/data/pptx/", "tdf127720.pptx");
+    Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xChartDoc.is());
+
+    uno::Reference< chart::XChartDataArray > 
xDataArray(xChartDoc->getDataProvider(), UNO_QUERY_THROW);
+    Sequence<OUString> aColumnDesc = xDataArray->getColumnDescriptions();
+    // Number of columns = 4 (Y-values, X-values and positive/negative error 
bars).
+    // Without the fix there would only be 2 columns (no error range).
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be 4 columns and descriptions", 
static_cast<sal_Int32>(4), aColumnDesc.getLength());
+}
+
 void Chart2ImportTest::testDOCXChartValuesSize()
 {
     load( u"/chart2/qa/extras/data/docx/", "bubblechart.docx" );
diff --git a/chart2/qa/extras/data/pptx/tdf127720.pptx 
b/chart2/qa/extras/data/pptx/tdf127720.pptx
new file mode 100644
index 000000000000..b10a4c5ab4ed
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf127720.pptx differ
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index ffbfebe10522..e1bf32b7ff10 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -568,7 +568,8 @@ InternalDataProvider::createDataSequenceFromArray( const 
OUString& rArrayStr, st
     }
 
     if (rRole == u"values-y" || rRole == u"values-first" || rRole == 
u"values-last" ||
-        rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size")
+        rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size" ||
+        rRole == u"error-bars-y-positive" || rRole == u"error-bars-y-negative")
     {
         // Column values.  Append a new data column and populate it.
 

Reply via email to