summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-01-05 21:20:02 -0500
committerXisco Fauli <xiscofauli@libreoffice.org>2024-01-10 14:20:49 +0100
commit371a2245d61cc6f6a994bc2914fe73a5aaf08e18 (patch)
treed4f1828e8d40aea0f2e9bd42525e7bc7845a2a63 /chart2
parenta6a9b274d4ef29c047a8c82132e85c3cc0a64ea3 (diff)
tdf#137691 chart2 import: provide NumberFormat to DataSeries
make CppunitTest_chart2_export3 CPPUNIT_TEST_NAME=tdf137691 This patch provides some very foundational support to importing a chart. It will open up a lot of doors to improve LinkToSource - since now the Source key is defined. Likely the source key should default to -1 instead of 0, so that LinkToSource can know whether or not the source is defined. /chart2/qa/extras/data/docx/testSeriesIdxOrder.docx is an example of where this patchset SHOULD have worked, but somehow it is losing its key during import... Unfortunately I have run out of time and can not follow these rabbit trails. Well, at least not until this change is considered a regression for some particular document... Change-Id: Ieddf2103002616aca2a408bde1f86d45c08dfc85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161702 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161845 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export3.cxx21
-rw-r--r--chart2/qa/extras/data/pptx/tdf137691_dataTable.pptxbin0 -> 49901 bytes
2 files changed, 21 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx
index 59416198ce0f..70bcc8fdfb18 100644
--- a/chart2/qa/extras/chart2export3.cxx
+++ b/chart2/qa/extras/chart2export3.cxx
@@ -664,6 +664,27 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTableOnPage3)
CPPUNIT_ASSERT_EQUAL(OUString("If oversubscription relative to allowance holds steady at average oversubscription level B15-B17"), aColumnDesc[3]);
}
+CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, tdf137691)
+{
+ // given a doc where the banana negative data formats as ($123) and the pineapple data as $(123)
+ loadFromFile(u"pptx/tdf137691_dataTable.pptx");
+ // saveAndReload("Impress MS PowerPoint 2007 XML"); // Always exports as key 0 (General)
+
+ Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
+
+ Reference< chart2::data::XDataSequence > xDataSeq;
+ xDataSeq.set(getDataSequenceFromDocByRole(xChartDoc, u"values-y", 0));
+ const sal_Int32 nKey_bananas = xDataSeq->getNumberFormatKeyByIndex(-1);
+ // This should not be General format (0), but a defined format (129)
+ CPPUNIT_ASSERT(nKey_bananas);
+
+ xDataSeq.set(getDataSequenceFromDocByRole(xChartDoc, u"values-y", 1));
+ const sal_Int32 nKey_pineapples = xDataSeq->getNumberFormatKeyByIndex(-1);
+ // This should not be General format (0), but a defined format (130)
+ CPPUNIT_ASSERT(nKey_pineapples);
+ CPPUNIT_ASSERT(nKey_pineapples != nKey_bananas);
+}
+
CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testMultipleAxisXLSX)
{
loadFromFile(u"ods/multiple_axis.ods");
diff --git a/chart2/qa/extras/data/pptx/tdf137691_dataTable.pptx b/chart2/qa/extras/data/pptx/tdf137691_dataTable.pptx
new file mode 100644
index 000000000000..edb465d729af
--- /dev/null
+++ b/chart2/qa/extras/data/pptx/tdf137691_dataTable.pptx
Binary files differ