diff options
-rw-r--r-- | chart2/qa/extras/chart2dump/chart2dump.cxx | 1 | ||||
-rw-r--r-- | chart2/qa/extras/chart2dump/reference/piecharttest/pie_chart_100_and_0.txt | 20 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 33 | ||||
-rw-r--r-- | chart2/qa/extras/data/ods/pie_chart_100_and_0.ods (renamed from chart2/qa/extras/chart2dump/data/pie_chart_100_and_0.ods) | bin | 11354 -> 11354 bytes |
4 files changed, 33 insertions, 21 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 4e91eeb9aa96..698782988434 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -856,7 +856,6 @@ DECLARE_DUMP_TEST(PieChartTest, Chart2DumpTest, false) "exploded_pie_chart.ods", "donut_chart.ods", "pie_chart_many_slices.ods", - "pie_chart_100_and_0.ods", }; for (const OUString& sTestFile : aTestFiles) diff --git a/chart2/qa/extras/chart2dump/reference/piecharttest/pie_chart_100_and_0.txt b/chart2/qa/extras/chart2dump/reference/piecharttest/pie_chart_100_and_0.txt deleted file mode 100644 index 40db143f4881..000000000000 --- a/chart2/qa/extras/chart2dump/reference/piecharttest/pie_chart_100_and_0.txt +++ /dev/null @@ -1,20 +0,0 @@ -// nSeriesCount -1 -/// Series 0 slices -// nSlicesCountInSeries -1 -/// /D=0:CS=0:CT=0:Series=0:Point=0 -// aSlicePosition.X -3210 -// aSlicePosition.Y -180 -// aSliceSize.Height -8639 -// aSliceSize.Width -8639 -// aSliceTransformation -8639;0;3210;0;8639;180;0;0;1 -// static_cast<sal_Int32>(aSliceFillStyle) -1 -// static_cast<sal_Int32>(aSliceFillColor) -17798
\ No newline at end of file diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 2172493e654e..3170042d3dd2 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -123,6 +123,7 @@ public: void testDataPointInheritedColorDOCX(); void testExternalStrRefsXLSX(); void testSourceNumberFormatComplexCategoriesXLS(); + void testTdf123504(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -200,6 +201,7 @@ public: CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testExternalStrRefsXLSX); CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS); + CPPUNIT_TEST(testTdf123504); CPPUNIT_TEST_SUITE_END(); @@ -1797,6 +1799,37 @@ void Chart2ImportTest::testSourceNumberFormatComplexCategoriesXLS() CPPUNIT_ASSERT(nNumberFormat != 0); } +void Chart2ImportTest::testTdf123504() +{ + load("/chart2/qa/extras/data/ods/", "pie_chart_100_and_0.ods"); + Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent), + UNO_QUERY_THROW); + + Reference<chart2::XChartDocument> xChartDoc2(xChartDoc, UNO_QUERY_THROW); + Reference<chart2::XChartType> xChartType(getChartTypeFromDoc(xChartDoc2, 0), UNO_SET_THROW); + std::vector aDataSeriesYValues = getDataSeriesYValuesFromChartType(xChartType); + CPPUNIT_ASSERT_EQUAL(size_t(1), aDataSeriesYValues.size()); + + Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); + Reference<drawing::XShape> xSeriesSlices(getShapeByName(xShapes, "CID/D=0:CS=0:CT=0:Series=0"), + UNO_SET_THROW); + + Reference<container::XIndexAccess> xIndexAccess(xSeriesSlices, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + Reference<drawing::XShape> xSlice(xIndexAccess->getByIndex(0), UNO_QUERY_THROW); + + // Check size and position of the only slice in the chart (100%) + // In the regressed state, it used to be 0-sized at position 0,0 + awt::Point aSlicePosition = xSlice->getPosition(); + CPPUNIT_ASSERT_GREATER(sal_Int32(3000), aSlicePosition.X); + CPPUNIT_ASSERT_GREATER(sal_Int32(150), aSlicePosition.Y); + awt::Size aSliceSize = xSlice->getSize(); + CPPUNIT_ASSERT_GREATER(sal_Int32(8500), aSliceSize.Height); + CPPUNIT_ASSERT_GREATER(sal_Int32(8500), aSliceSize.Width); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/chart2dump/data/pie_chart_100_and_0.ods b/chart2/qa/extras/data/ods/pie_chart_100_and_0.ods Binary files differindex a6ff5d6aa0e1..a6ff5d6aa0e1 100644 --- a/chart2/qa/extras/chart2dump/data/pie_chart_100_and_0.ods +++ b/chart2/qa/extras/data/ods/pie_chart_100_and_0.ods |