diff options
author | Vinaya Mandke <vinaya.mandke@synerzip.com> | 2013-10-31 11:46:10 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-01 05:08:12 -0500 |
commit | 486222c7c003e250813bd885a95192bc63cc9830 (patch) | |
tree | 0fe5010214532781df886f4da1c037ff21635659 /chart2/qa/extras | |
parent | 2c2ff538908e4c61987469c9e09325c2b479b185 (diff) |
Unit test for Docx Chart Series Name
UT to verify that the series labels are
imported (or rendered) as in the docx file.
Change-Id: I9e4ade7a905dbb894bc163ecec8c333fa6797818
Reviewed-on: https://gerrit.libreoffice.org/6502
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'chart2/qa/extras')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 40 | ||||
-rw-r--r-- | chart2/qa/extras/charttest.hxx | 20 | ||||
-rw-r--r-- | chart2/qa/extras/data/docx/chart.docx | bin | 0 -> 17749 bytes |
3 files changed, 32 insertions, 28 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index f20b834fb7c5..9ca95b616435 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -9,7 +9,6 @@ #include "charttest.hxx" -#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> @@ -17,7 +16,6 @@ #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XChartData.hpp> #include <com/sun/star/chart2/XInternalDataProvider.hpp> -#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> class Chart2ImportTest : public ChartTest @@ -31,6 +29,7 @@ public: void testXLSChartSeries(); void testODTChartSeries(); void testDOCChartSeries(); + void testDOCXChartSeries(); void testPPTXChartSeries(); void testPPTChartSeries(); void testODPChartSeries(); @@ -44,6 +43,7 @@ public: CPPUNIT_TEST(testXLSChartSeries); CPPUNIT_TEST(testODTChartSeries); CPPUNIT_TEST(testDOCChartSeries); + CPPUNIT_TEST(testDOCXChartSeries); /* * Disabling Impress Uts. * ChartTest::tearDown() calls dispose of mxComponent @@ -225,19 +225,7 @@ void Chart2ImportTest::testXLSChartSeries() void Chart2ImportTest::testODTChartSeries() { load("/chart2/qa/extras/data/odt/", "chart.odt"); - uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); - uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT( xShape.is() ); - uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - uno::Reference< chart2::XChartDocument > xChartDoc; - xChartDoc.set( xPropertySet->getPropertyValue( "Model" ), uno::UNO_QUERY ); - CPPUNIT_ASSERT( xChartDoc.is() ); - CPPUNIT_ASSERT( xChartDoc->getDataProvider().is() ); - uno::Reference<beans::XPropertySet> xProp(xChartDoc->getDataProvider(), uno::UNO_QUERY ); - uno::Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess ( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); - CPPUNIT_ASSERT( xAnyDescriptionAccess.is() ); - uno::Sequence< OUString > seriesList = xAnyDescriptionAccess->getColumnDescriptions(); + uno::Sequence< OUString > seriesList = getWriterChartColumnDescriptions(mxComponent); CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]); CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]); CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]); @@ -247,24 +235,20 @@ void Chart2ImportTest::testODTChartSeries() void Chart2ImportTest::testDOCChartSeries() { load("/chart2/qa/extras/data/doc/", "chart.doc"); - uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); - uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT( xShape.is() ); - uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - uno::Reference< chart2::XChartDocument > xChartDoc; - xChartDoc.set( xPropertySet->getPropertyValue( "Model" ), uno::UNO_QUERY ); - CPPUNIT_ASSERT( xChartDoc.is() ); - CPPUNIT_ASSERT( xChartDoc->getDataProvider().is() ); - uno::Reference<beans::XPropertySet> xProp(xChartDoc->getDataProvider(), uno::UNO_QUERY ); - uno::Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess ( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); - CPPUNIT_ASSERT( xAnyDescriptionAccess.is() ); - uno::Sequence< OUString > seriesList = xAnyDescriptionAccess->getColumnDescriptions(); + uno::Sequence< OUString > seriesList = getWriterChartColumnDescriptions(mxComponent); CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]); CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]); CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]); } +void Chart2ImportTest::testDOCXChartSeries() +{ + load("/chart2/qa/extras/data/docx/", "chart.docx"); + uno::Sequence< OUString > seriesList = getWriterChartColumnDescriptions(mxComponent); + CPPUNIT_ASSERT_EQUAL(OUString("Series 1"), seriesList[0]); + CPPUNIT_ASSERT_EQUAL(OUString("Series 2"), seriesList[1]); + CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), seriesList[2]); +} void Chart2ImportTest::testPPTChartSeries() { diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index b33312c00422..637cfe07a9f0 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -27,6 +27,8 @@ #include <unotools/tempfile.hxx> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XDataSeries.hpp> @@ -165,6 +167,24 @@ Reference< chart2::XDataSeries > getDataSeriesFromDoc( uno::Reference< chart2::X } +uno::Sequence < OUString > getWriterChartColumnDescriptions( Reference< lang::XComponent > mxComponent ) +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT( xShape.is() ); + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Reference< chart2::XChartDocument > xChartDoc; + xChartDoc.set( xPropertySet->getPropertyValue( "Model" ), uno::UNO_QUERY ); + CPPUNIT_ASSERT( xChartDoc.is() ); + CPPUNIT_ASSERT( xChartDoc->getDataProvider().is() ); + uno::Reference<beans::XPropertySet> xProp(xChartDoc->getDataProvider(), uno::UNO_QUERY ); + uno::Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess ( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); + CPPUNIT_ASSERT( xAnyDescriptionAccess.is() ); + uno::Sequence< OUString > seriesList = xAnyDescriptionAccess->getColumnDescriptions(); + return seriesList; +} + uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const char* pDir, const char* pName ) { mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Draw.PresentationDocument"); diff --git a/chart2/qa/extras/data/docx/chart.docx b/chart2/qa/extras/data/docx/chart.docx Binary files differnew file mode 100644 index 000000000000..f9cddd4949a6 --- /dev/null +++ b/chart2/qa/extras/data/docx/chart.docx |