diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-25 12:16:22 +0900 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-08-13 09:50:37 +0000 |
commit | 2b129825f90bf7aee51e57fd11a5b81fbd5f16d1 (patch) | |
tree | 720ac95cef95e961e36d095765ed782b2e3a06fe /chart2/qa | |
parent | b3abc191e24bd2e812836257024d14557a6238ce (diff) |
tdf#76649 test case for this issue
Change-Id: I8b88298c79e04e972b208dd74dcd693d53d0bb98
Reviewed-on: https://gerrit.libreoffice.org/17344
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r-- | chart2/qa/extras/xshape/chart2xshape.cxx | 39 | ||||
-rw-r--r-- | chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods | bin | 0 -> 12060 bytes |
2 files changed, 35 insertions, 4 deletions
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 <com/sun/star/qa/XDumper.hpp> #include <test/xmldiff.hxx> +#include <test/xmltesttools.hxx> #include <fstream> -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<const xmlChar*>(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 Binary files differnew file mode 100644 index 000000000000..1032e960b93f --- /dev/null +++ b/chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods |