diff options
Diffstat (limited to 'chart2')
-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 4a7ccb373685..844d7208bac0 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -90,6 +90,7 @@ public: // void testTextCanOverlapXLSX(); // TODO : temporarily disabled. void testTextBreakXLSX(); void testNumberFormatsXLSX(); + void testNumberFormatsDOCX(); void testTransparentBackground(OUString const & filename); @@ -204,6 +205,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); @@ -1284,6 +1286,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 |