diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-01-03 13:24:32 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2018-01-28 14:29:29 +0100 |
commit | 1ede9f7ff6f2250fa2c75bc4dc099246a59dcec0 (patch) | |
tree | 184eb89ffeafee3d20f131af2377e7e48cf5643c /sd | |
parent | 2f564d09c5d3aff0767f3c3f3e525cf34076cff3 (diff) |
tdf#114821 calculate correct label position
Max is now equal to whole surface size, not only point pos.
Change-Id: If231fb7224b23e9993fcf575f5a020ca8e2b04ab
Reviewed-on: https://gerrit.libreoffice.org/48242
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf114821.pptx | bin | 0 -> 50178 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 38 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf114821.pptx b/sd/qa/unit/data/pptx/tdf114821.pptx Binary files differnew file mode 100644 index 000000000000..3399b31313e7 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf114821.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 3993d0bf33bc..71b18c2e3a4a 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimate.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -172,6 +173,7 @@ public: void testTdf90626(); void testTdf114488(); void testTdf114913(); + void testTdf114821(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -248,6 +250,7 @@ public: CPPUNIT_TEST(testTdf90626); CPPUNIT_TEST(testTdf114488); CPPUNIT_TEST(testTdf114913); + CPPUNIT_TEST(testTdf114821); CPPUNIT_TEST_SUITE_END(); }; @@ -2330,6 +2333,41 @@ void SdImportTest::testTdf114913() xDocShRef->DoClose(); } +void SdImportTest::testTdf114821() +{ + css::uno::Any aAny; + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "/sd/qa/unit/data/pptx/tdf114821.pptx" ), PPTX ); + + uno::Reference< beans::XPropertySet > xPropSet( getShapeFromPage( 0, 0, xDocShRef ) ); + aAny = xPropSet->getPropertyValue( "Model" ); + CPPUNIT_ASSERT_MESSAGE( "The shape doesn't have the property", aAny.hasValue() ); + + uno::Reference< chart::XChartDocument > xChartDoc; + aAny >>= xChartDoc; + CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc.is() ); + uno::Reference< chart2::XChartDocument > xChart2Doc( xChartDoc, uno::UNO_QUERY ); + CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc.is() ); + + uno::Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xChart2Doc->getFirstDiagram(), uno::UNO_QUERY ); + uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xBCooSysCnt->getCoordinateSystems() ); + uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[0], uno::UNO_QUERY ); + + uno::Reference< chart2::XDataSeriesContainer > xDSCnt( xCTCnt->getChartTypes()[0], uno::UNO_QUERY ); + CPPUNIT_ASSERT_MESSAGE( "failed to load data series", xDSCnt.is() ); + uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Series count", static_cast<sal_Int32>( 1 ), aSeriesSeq.getLength() ); + + const css::uno::Reference< css::beans::XPropertySet >& rPropSet0( aSeriesSeq[0]->getDataPointByIndex( 0 ) ); + CPPUNIT_ASSERT( rPropSet0.is() ); + + // Check the first label + sal_Int32 aPlacement; + rPropSet0->getPropertyValue( "LabelPlacement" ) >>= aPlacement; + CPPUNIT_ASSERT_EQUAL( css::chart::DataLabelPlacement::TOP_LEFT, aPlacement ); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |