summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorSourav <sourav.mahajan@synerzip.com>2014-04-15 16:39:52 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-04-28 09:51:00 +0000
commita211c754003f98bc8f7761224a0b265bd224f61f (patch)
treedcf0f5ab6cfebed67a46555666e92b3b46b11621 /chart2/qa
parent89e14d6c318580354081b3b3ad39188f25481ae7 (diff)
fdo77216-Charts-Scattered chart: Chart gets distorted on RT
In case there is some text entered in place of X coordinates for scatter chart then x coordinates should be taken as 1,2,3.... MS Word does the same thing Change-Id: I1db0fd64c6ac0f4d5e77a9676812f5e26577ecf6 Reviewed-on: https://gerrit.libreoffice.org/9011 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx38
-rw-r--r--chart2/qa/extras/data/docx/fdo77216.docxbin0 -> 23974 bytes
2 files changed, 38 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index bc1dcd3f61ee..eded887bbb3f 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -36,6 +36,7 @@ public:
void testStockChart();
void testBarChart();
void testCrosses();
+ void testScatterChart();
void testChartDataTable();
void testChartExternalData();
void testEmbeddingsGrabBag();
@@ -64,6 +65,7 @@ public:
CPPUNIT_TEST(testStockChart);
CPPUNIT_TEST(testBarChart);
CPPUNIT_TEST(testCrosses);
+ CPPUNIT_TEST(testScatterChart);
CPPUNIT_TEST(testChartDataTable);
CPPUNIT_TEST(testChartExternalData);
CPPUNIT_TEST(testEmbeddingsGrabBag);
@@ -117,6 +119,14 @@ protected:
* Same as the assertXPath(), but don't assert: return the string instead.
*/
OUString getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute);
+ /**
+ Assert that rXPath exists, and its content equals rContent.
+ */
+ void assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent);
+ /**
+ Same as the assertXPathContent(), but don't assert: return the string instead.
+ */
+ OUString getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath);
private:
};
@@ -211,6 +221,24 @@ void Chart2ExportTest::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int
nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
}
+void Chart2ExportTest::assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent)
+{
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("XPath contents of child does not match", rContent, getXPathContent(pXmlDoc, rXPath));
+}
+
+OUString Chart2ExportTest::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
+{
+ xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
+
+ CPPUNIT_ASSERT_MESSAGE(OString("XPath '" + rXPath + "' not found").getStr(),
+ xmlXPathNodeSetGetLength(pXmlNodes) > 0);
+
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+
+ _xmlNode *pNode = &(pXmlNode->children[0]);
+ return pNode ? OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)) : OUString();
+}
+
OUString Chart2ExportTest::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute)
{
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -479,6 +507,16 @@ void Chart2ExportTest::testCrosses()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
}
+void Chart2ExportTest::testScatterChart()
+{
+ load("/chart2/qa/extras/data/docx/", "fdo77216.docx");
+ xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+ if (!pXmlDoc)
+ return;
+
+ assertXPathContent(pXmlDoc, "//c:scatterChart/c:ser[1]/c:xVal[1]/c:numRef[1]/c:numCache[1]/c:pt[1]/c:v[1]", "1");
+}
+
void Chart2ExportTest::testChartDataTable()
{
load("/chart2/qa/extras/data/docx/", "testChartDataTable.docx");
diff --git a/chart2/qa/extras/data/docx/fdo77216.docx b/chart2/qa/extras/data/docx/fdo77216.docx
new file mode 100644
index 000000000000..b741bbce2157
--- /dev/null
+++ b/chart2/qa/extras/data/docx/fdo77216.docx
Binary files differ