summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2018-01-03 23:27:16 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2018-01-09 13:36:42 +0100
commit84392651d2731cce91c3b2e144bed4ac07e4ddf1 (patch)
tree9c5fc708db070bbafc208268bb65afde5d3ddace /chart2/qa
parent847d20b3466a6358396c923e9b4754cbdd53863a (diff)
tdf#114173 Preserve size of chart legend during xlsx export
During export chart into .xlsx file, the information about size of legend was not saved. Example of proper size: <c:w val="0.41459448854442293"/> <c:h val="0.23161616722845749"/> another issue was hardcoded "layoutTarget" which was always "inner": <c:layoutTarget val="inner"/> also properties regarding default text style was not preserved: <c:txPr> <a:bodyPr/> <a:lstStyle/> <a:p> <a:pPr> <a:defRPr sz="900" b="0" i="0" u="none" strike="noStrike" kern="1200" baseline="0"> <a:solidFill> <a:schemeClr val="tx1"> <a:lumMod val="65000"/> <a:lumOff val="35000"/> </a:schemeClr> </a:solidFill> </a:defRPr> </a:pPr> <a:endParaRPr lang="pl-PL"/> </a:p> </c:txPr> With this patch all these issues was resolved, and in case of layoutTarget "outer", the field is not availble at all, according to specification. Change-Id: I2c9b7a112bdd911542b5273e660222d7fefa2d88 Reviewed-on: https://gerrit.libreoffice.org/47358 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index b68f969cb90b..6764935a91cc 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1407,6 +1407,7 @@ void Chart2ExportTest::testTitleManualLayoutXLSX()
load("/chart2/qa/extras/data/xlsx/", "title_manual_layout.xlsx");
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:layout/c:manualLayout/c:layoutTarget", 0);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:layout/c:manualLayout/c:xMode", "val", "edge");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:layout/c:manualLayout/c:yMode", "val", "edge");
@@ -1428,6 +1429,7 @@ void Chart2ExportTest::testPlotAreaManualLayoutXLSX()
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:layoutTarget", "val", "inner");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:xMode", "val", "edge");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:yMode", "val", "edge");
@@ -1456,6 +1458,7 @@ void Chart2ExportTest::testLegendManualLayoutXLSX()
xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:layoutTarget", 0);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:layout/c:manualLayout/c:xMode", "val", "edge");
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:layout/c:manualLayout/c:yMode", "val", "edge");
@@ -1467,6 +1470,18 @@ void Chart2ExportTest::testLegendManualLayoutXLSX()
double nY = aYVal.toDouble();
CPPUNIT_ASSERT(nY > 0 && nY < 1);
CPPUNIT_ASSERT(nX != nY);
+
+ OUString aWVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:layout/c:manualLayout/c:w", "val");
+ double nW = aWVal.toDouble();
+ CPPUNIT_ASSERT(nW > 0 && nW < 1);
+
+ OUString aHVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:layout/c:manualLayout/c:h", "val");
+ double nH = aHVal.toDouble();
+ CPPUNIT_ASSERT(nH > 0 && nH < 1);
+ CPPUNIT_ASSERT(nH != nW);
+
+ // Make sure that default text font size is preserved after export
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:txPr/a:p/a:pPr/a:defRPr", "sz", "900");
}
void Chart2ExportTest::testAxisCharacterPropertiesXLSX()