summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-08-15 11:25:02 +0200
committerLászló Németh <nemeth@numbertext.org>2019-08-21 10:10:08 +0200
commit96a29c12a9d8734c9d2a812f38fc6654b5df9c48 (patch)
treea0fa0bb8848eb0fd36e7ffbaf276497097fec4fb /chart2
parentd7b227d116086ef2023ae9b8b0eef8288c46cf3c (diff)
tdf#101322 Chart OOXML Export: fix missing subtitle
Concatenate subtitle and main title texts, if both exist, just like at the XLS/DOC export, because OOXML does not support subtitles. If we only have a subtitle, export the whole subtitle shape instead of the title shape, keeping its properties. Change-Id: If6a27c023fcce58f4549a0edad44027bb0348b93 Reviewed-on: https://gerrit.libreoffice.org/77499 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx33
-rw-r--r--chart2/qa/extras/data/ods/testChartMainWithSubTitle.odsbin0 -> 12317 bytes
-rw-r--r--chart2/qa/extras/data/ods/testChartSubTitle.odsbin0 -> 12598 bytes
3 files changed, 33 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index ab932ac2bc68..78a763ee7bb6 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -103,6 +103,8 @@ public:
void testTitleManualLayoutXLSX();
void testPlotAreaManualLayoutXLSX();
void testLegendManualLayoutXLSX();
+ void testChartSubTitle();
+ void testChartMainWithSubTitle();
void testChartTitlePropertiesColorFillXLSX();
void testChartTitlePropertiesGradientFillXLSX();
void testChartTitlePropertiesBitmapFillXLSX();
@@ -203,6 +205,8 @@ public:
CPPUNIT_TEST(testTitleManualLayoutXLSX);
CPPUNIT_TEST(testPlotAreaManualLayoutXLSX);
CPPUNIT_TEST(testLegendManualLayoutXLSX);
+ CPPUNIT_TEST(testChartSubTitle);
+ CPPUNIT_TEST(testChartMainWithSubTitle);
CPPUNIT_TEST(testChartTitlePropertiesColorFillXLSX);
CPPUNIT_TEST(testChartTitlePropertiesGradientFillXLSX);
CPPUNIT_TEST(testChartTitlePropertiesBitmapFillXLSX);
@@ -1645,6 +1649,35 @@ void Chart2ExportTest::testLegendManualLayoutXLSX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:legend/c:txPr/a:p/a:pPr/a:defRPr", "sz", "900");
}
+void Chart2ExportTest::testChartSubTitle()
+{
+ load("/chart2/qa/extras/data/ods/", "testChartSubTitle.ods");
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ // test properties of subtitle
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "sz", "1100");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "b", "1");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "00a933");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr/a:latin", "typeface", "Times New Roman");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t", "It is a Subtitle");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "b2b2b2");
+}
+
+void Chart2ExportTest::testChartMainWithSubTitle()
+{
+ load("/chart2/qa/extras/data/ods/", "testChartMainWithSubTitle.ods");
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ // test properties of title
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "sz", "1300");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "b", "0");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "i", "1");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "f10d0c");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr/a:latin", "typeface", "Arial");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t", "It is a Maintitle\nIt is a Subtitle");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "81d41a");
+}
+
void Chart2ExportTest::testChartTitlePropertiesColorFillXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesColorFill.xlsx");
diff --git a/chart2/qa/extras/data/ods/testChartMainWithSubTitle.ods b/chart2/qa/extras/data/ods/testChartMainWithSubTitle.ods
new file mode 100644
index 000000000000..5ae4fa7d99a7
--- /dev/null
+++ b/chart2/qa/extras/data/ods/testChartMainWithSubTitle.ods
Binary files differ
diff --git a/chart2/qa/extras/data/ods/testChartSubTitle.ods b/chart2/qa/extras/data/ods/testChartSubTitle.ods
new file mode 100644
index 000000000000..1c7814195d17
--- /dev/null
+++ b/chart2/qa/extras/data/ods/testChartSubTitle.ods
Binary files differ