[Libreoffice-commits] core.git: chart2/qa

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Thu Aug 13 02:50:57 PDT 2015


 chart2/qa/extras/xshape/chart2xshape.cxx                   |   39 +++++++++++--
 chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods |binary
 2 files changed, 35 insertions(+), 4 deletions(-)

New commits:
commit 2b129825f90bf7aee51e57fd11a5b81fbd5f16d1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sat Jul 25 12:16:22 2015 +0900

    tdf#76649 test case for this issue
    
    Change-Id: I8b88298c79e04e972b208dd74dcd693d53d0bb98
    Reviewed-on: https://gerrit.libreoffice.org/17344
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx
index f48cdc9..f57fdfc 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
new file mode 100644
index 0000000..1032e96
Binary files /dev/null and b/chart2/qa/extras/xshape/data/ods/tdf76649_TrendLineBug.ods differ


More information about the Libreoffice-commits mailing list