[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - chart2/qa oox/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 24 09:18:33 UTC 2021


 chart2/qa/extras/chart2export.cxx            |   17 ++++++++++++++---
 chart2/qa/extras/data/xlsx/tdf142351.xlsx    |binary
 oox/source/drawingml/chart/axisconverter.cxx |    4 ++--
 3 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit e9fd6d94c3fe58ad6319daba5afca644e4e699a7
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Aug 17 14:28:48 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Aug 24 11:17:54 2021 +0200

    tdf#142351 chart ooxml import: fix category axis cross position
    
    Set PROP_CrossoverPosition value regardless of the mrModel.mbAuto
    value, which is a different thing. This element specifies that
    this axis is a date or text axis based on the data that is used for
    the axis labels, not a specific choice.
    
    Change-Id: Ifa291aac2f4bb3981d968de3489b23f1af485104
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120592
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit e701732725dd641741f39020d7dc965bc4db765d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120875
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 89dcdeb529fd..608905e59328 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -531,10 +531,21 @@ void Chart2ExportTest::testBarChart()
 
 void Chart2ExportTest::testCrosses()
 {
-    load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
-    xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+    // test crosses val="autoZero" with DOCX
+    {
+        load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
+        xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+
+        assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
+    }
+    // tdf#142351: test crossesAt val="-50" with XLSX
+    {
+        load(u"/chart2/qa/extras/data/xlsx/", "tdf142351.xlsx");
+        xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+        CPPUNIT_ASSERT(pXmlDoc);
 
-    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
+        assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crossesAt", "val", "-50");
+    }
 }
 
 void Chart2ExportTest::testScatterChartTextXValues()
diff --git a/chart2/qa/extras/data/xlsx/tdf142351.xlsx b/chart2/qa/extras/data/xlsx/tdf142351.xlsx
new file mode 100644
index 000000000000..0414bb3f1625
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf142351.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 7aa141c0f798..4620f5b5a15c 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -372,8 +372,8 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord
             case XML_max:       eAxisPos = cssc::ChartAxisPosition_END;     break;
             case XML_autoZero:  eAxisPos = cssc::ChartAxisPosition_ZERO;   break;
         }
-        if( !mrModel.mbAuto )
-            aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
+
+        aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
 
         // calculate automatic origin depending on scaling mode of crossing axis
         bool bCrossingLogScale = pCrossingAxis && lclIsLogarithmicScale( *pCrossingAxis );


More information about the Libreoffice-commits mailing list