From 2b129825f90bf7aee51e57fd11a5b81fbd5f16d1 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sat, 25 Jul 2015 12:16:22 +0900 Subject: tdf#76649 test case for this issue Change-Id: I8b88298c79e04e972b208dd74dcd693d53d0bb98 Reviewed-on: https://gerrit.libreoffice.org/17344 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky --- chart2/qa/extras/xshape/chart2xshape.cxx | 39 ++++++++++++++++++--- .../xshape/data/ods/tdf76649_TrendLineBug.ods | Bin 0 -> 12060 bytes 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods (limited to 'chart2/qa') diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index f48cdc945289..f57fdfc1a272 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -20,27 +20,31 @@ #include #include +#include #include -class Chart2XShapeTest : public ChartTest +class Chart2XShapeTest : public ChartTest, public XmlTestTools { public: void testFdo75075(); void testPropertyMappingBarChart(); void testPieChartLabels1(); + void testTdf76649TrendLineBug(); CPPUNIT_TEST_SUITE(Chart2XShapeTest); CPPUNIT_TEST(testFdo75075); CPPUNIT_TEST(testPropertyMappingBarChart); CPPUNIT_TEST(testPieChartLabels1); + CPPUNIT_TEST(testTdf76649TrendLineBug); CPPUNIT_TEST_SUITE_END(); private: void compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference = false); - + OUString getXShapeDumpString(); + xmlDocPtr getXShapeDumpXmlDoc(); }; namespace { @@ -58,11 +62,24 @@ bool checkDumpAgainstFile( const OUString& rDump, const OUString& aFilePath) } -void Chart2XShapeTest::compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference) +OUString Chart2XShapeTest::getXShapeDumpString() { uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW); uno::Reference< qa::XDumper > xDumper( xChartDoc, UNO_QUERY_THROW ); - OUString aDump = xDumper->dump(); + return xDumper->dump(); +} + +xmlDocPtr Chart2XShapeTest::getXShapeDumpXmlDoc() +{ + OUString rDump = getXShapeDumpString(); + OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); + return xmlParseDoc(reinterpret_cast(aXmlDump.getStr())); +} + +void Chart2XShapeTest::compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference) +{ + OUString aDump = getXShapeDumpString(); + OUString aReference = getPathFromSrc("/chart2/qa/extras/xshape/data/reference/") + rReferenceFile; if(bCreateReference) { @@ -96,6 +113,20 @@ void Chart2XShapeTest::testPieChartLabels1() compareAgainstReference("tdf90839-1.xml"); } +void Chart2XShapeTest::testTdf76649TrendLineBug() +{ + // This bug prevents that the trendline (regression curve) is drawn + // if the first cell is empty. See tdf#76649 for details. + + load("chart2/qa/extras/xshape/data/ods/", "tdf76649_TrendLineBug.ods"); + + xmlDocPtr pXmlDoc = getXShapeDumpXmlDoc(); + + // Check if the regression curve exists (which means a XShape with a certain + // name should exist in the dump) + assertXPath(pXmlDoc, "//XShape[@name='CID/D=0:CS=0:CT=0:Series=0:Curve=0']", 1); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2XShapeTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods b/chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods new file mode 100644 index 000000000000..1032e960b93f Binary files /dev/null and b/chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods differ -- cgit v1.2.3