From c86be45d343635f2e137b8ea710d87e1a612101d Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Fri, 7 Jul 2017 16:07:28 +0530 Subject: tdf#108986 : no arrow for "Data" button on pivot chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also changed the fill color of "Data" button to a lighter shade to distiguish it from other buttons, for both row and column fields. Added matching testcase in chart2dump.cxx Change-Id: I2ae5da6c3552372f606da41055f1e0663b6f0802 Reviewed-on: https://gerrit.libreoffice.org/39687 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- chart2/qa/extras/chart2dump/chart2dump.cxx | 44 +++++++++++++++++++++ .../chart2dump/data/pivotchart_data_button.ods | Bin 0 -> 18366 bytes .../pivotchart_data_button.txt | 2 + 3 files changed, 46 insertions(+) create mode 100644 chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods create mode 100644 chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt (limited to 'chart2/qa') diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 989d50819d04..56bf59ecca31 100755 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -1119,6 +1119,50 @@ DECLARE_DUMP_TEST(PointLineChartTest, Chart2DumpTest, false) } } +DECLARE_DUMP_TEST( PivotChartDataButtonTest, Chart2DumpTest, false ) +{ + const OUString aTestFile = "pivotchart_data_button.ods"; + + setTestFileName( aTestFile ); + load( getTestFileDirName(), getTestFileName() ); + + // Check that we have pivot chart in the document + uno::Reference xTablePivotCharts = getTablePivotChartsFromSheet( 1, mxComponent ); + uno::Reference xIndexAccess( xTablePivotCharts, UNO_QUERY_THROW ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xIndexAccess->getCount() ); + + // Get the pivot chart document so we ca access its data + uno::Reference xChartDoc; + xChartDoc.set( getPivotChartDocFromSheet( xTablePivotCharts, 0 ) ); + CPPUNIT_ASSERT( xChartDoc.is() ); + + uno::Reference xDrawPageSupplier( xChartDoc, uno::UNO_QUERY ); + uno::Reference xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference xShapes( xDrawPage->getByIndex(0), uno::UNO_QUERY ); + CPPUNIT_ASSERT( xShapes.is() ); + + // Get the shape that represents the "Data" button. + uno::Reference xButton = getShapeByName( xShapes, "FieldButton.Row.8", + []( const uno::Reference& xShapeNode ) + { + return xShapeNode->getShapeType() == "com.sun.star.drawing.TextShape"; + } ); + CPPUNIT_ASSERT_MESSAGE( OString( "Cannot find Data button shape" ).getStr(), xButton.is() ); + + // Make sure that there is no arrow shape with the Data button + uno::Reference xArrow = getShapeByName( xShapes, "FieldButton.Row.8", + []( const uno::Reference& xShapeNode ) + { + return xShapeNode->getShapeType() == "com.sun.star.drawing.PolyPolygonShape"; + } ); + CPPUNIT_ASSERT_MESSAGE( OString( "Arrow shape should not be present for the Data button" ).getStr(), !xArrow.is() ); + + // Assert the background color of the Data button + util::Color aButtonFillColor = 0; + uno::Reference xPropSet( xButton, UNO_QUERY_THROW ); + xPropSet->getPropertyValue( UNO_NAME_FILLCOLOR ) >>= aButtonFillColor; + CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL( static_cast( aButtonFillColor ) ); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods b/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods new file mode 100644 index 000000000000..d57edf66d29b Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods differ diff --git a/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt b/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt new file mode 100644 index 000000000000..3d7d8a55c6cc --- /dev/null +++ b/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt @@ -0,0 +1,2 @@ +// static_cast( aButtonFillColor ) +16185078 -- cgit