summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorumeshkadam <umesh.kadam@synerzip.com>2014-02-07 17:27:49 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-13 09:55:36 +0100
commit9d5005a70cc42ee9f45104cc32aa099d0c3d6630 (patch)
treeb73dba609fa7d0e13e16a5ff1f1886826f28830b /chart2/qa
parent8f8bc0dcf3bc253ae49159d52db049767f476ced (diff)
FDO#74430: File Corruption due to repetition of docPr Id
Issue : - If there is a scenario where a chart is followed by a shape (may it be in the footer or on a different page ) which is being exported as an alternate content then, the docPr Id is being repeated, ECMA 20.4.2.5 says that the docPr Id should be unique. - Two different variables were been used as counters for the docPr Id, hence there were repitions in the docPr Id. Implementation : - ensured that a single counter is used to track the docPr Id. Conflicts: chart2/qa/extras/chart2export.cxx Reviewed on: https://gerrit.libreoffice.org/7916 Change-Id: I1c105be184d045ef058423f03259eb8c634fcbbe
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx23
-rw-r--r--chart2/qa/extras/data/docx/FDO74430.docxbin0 -> 19199 bytes
2 files changed, 23 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 6288d3d3f74e..c15f5af2f5c1 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -46,6 +46,7 @@ public:
void testFdo74115WallGradientFill();
void testFdo74115WallBitmapFill();
void testBarChartRotation();
+ void testShapeFollowedByChart();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(test);
@@ -64,6 +65,7 @@ public:
// CPPUNIT_TEST(testFdo74115WallGradientFill);
CPPUNIT_TEST(testFdo74115WallBitmapFill);
CPPUNIT_TEST(testBarChartRotation);
+ CPPUNIT_TEST(testShapeFollowedByChart);
CPPUNIT_TEST_SUITE_END();
protected:
@@ -169,6 +171,10 @@ xmlNodeSetPtr Chart2ExportTest::getXPathNode(xmlDocPtr pXmlDoc, const OString& r
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("mc"), BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wps"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wpg"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wp"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx);
return pXmlXpathObj->nodesetval;
}
@@ -578,6 +584,23 @@ void Chart2ExportTest::testBarChartRotation()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:view3D/c:rotY", "val", "50");
}
+void Chart2ExportTest::testShapeFollowedByChart()
+{
+ /* If there is a scenario where a chart is followed by a shape
+ which is being exported as an alternate content then, the
+ docPr Id is being repeated, ECMA 20.4.2.5 says that the
+ docPr Id should be unique, ensuring the same here.
+ */
+ load("/chart2/qa/extras/data/docx/", "FDO74430.docx");
+ xmlDocPtr pXmlDoc = parseExport("word/document", "Office Open XML Text" );
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id");
+ OUString aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id");
+ CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR );
+
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/FDO74430.docx b/chart2/qa/extras/data/docx/FDO74430.docx
new file mode 100644
index 000000000000..f4a68b519db2
--- /dev/null
+++ b/chart2/qa/extras/data/docx/FDO74430.docx
Binary files differ