diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-04-22 14:41:49 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-04-28 14:56:57 +0200 |
commit | d1466728e243b706d4fae2c5eeef2ee867ec4a89 (patch) | |
tree | 774fb8c63a64067a829596de741d1061cdccfe9c /chart2/qa/extras | |
parent | 50670fc723066c0598ed8f482c575bfb290d6a05 (diff) |
tdf#132174 Chart DOCX import: fix label number format
The inner data table of charts has no own cell number format,
unlike the MSO embedded XLSX, so we always have to set the link
number format to false, if we have an inner data table.
Regression from commit: 9c1063ba13028244346528e307d5563d6faf949d
(tdf#129173 tdf#129175 Fix number format of data labels)
Change-Id: I5e7865cb8c19fc6fae5b68305c7dc302516c0ad4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92695
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: Tünde Tóth <tundeth@gmail.com>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit e0da00d655ecca5986eea3812a8a670c6adbc40f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93007
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2/qa/extras')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 24 | ||||
-rw-r--r-- | chart2/qa/extras/data/docx/tdf132174.docx | bin | 0 -> 13865 bytes |
2 files changed, 24 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index e637c3272d33..a2b77a851002 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -88,6 +88,7 @@ public: // void testTextCanOverlapXLSX(); // TODO : temporarily disabled. void testTextBreakXLSX(); void testNumberFormatsXLSX(); + void testNumberFormatsDOCX(); void testTransparentBackground(OUString const & filename); @@ -200,6 +201,7 @@ public: // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled. CPPUNIT_TEST(testTextBreakXLSX); CPPUNIT_TEST(testNumberFormatsXLSX); + CPPUNIT_TEST(testNumberFormatsDOCX); CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX); CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX); CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX); @@ -1267,6 +1269,28 @@ void Chart2ImportTest::testNumberFormatsXLSX() CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess && bLinkNumberFormatToSource); } +void Chart2ImportTest::testNumberFormatsDOCX() +{ + load("/chart2/qa/extras/data/docx/", "tdf132174.docx"); + uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + + css::uno::Reference<chart2::XDiagram> xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW); + Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0); + uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xPropertySet.is()); + + sal_Int32 nNumberFormat; + bool bLinkNumberFormatToSource = true; + const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, "0%"); + xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat; + CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat); + xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource; + // LinkNumberFormatToSource should be set to false even if the OOXML contain a true value, + // because the inner data table of charts have no own number format! + CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !bLinkNumberFormatToSource); +} + void Chart2ImportTest::testAutoTitleDelDefaultValue2007XLSX() { load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx"); diff --git a/chart2/qa/extras/data/docx/tdf132174.docx b/chart2/qa/extras/data/docx/tdf132174.docx Binary files differnew file mode 100644 index 000000000000..4f43695784fb --- /dev/null +++ b/chart2/qa/extras/data/docx/tdf132174.docx |