summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorsushil_shinde <sushil.shinde@synerzip.com>2014-03-19 18:34:45 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-23 11:02:16 +0100
commit23b65a84fd827555dfb84c7e2f78879c479c2f78 (patch)
tree67268495c42ca6639ab4e76d27eff53319c017d6 /chart2/qa
parentcfde7ea8ee8526a66db22d690ef2de0f43c76d0b (diff)
fdo#76356 : Docx file contianing chart in footer/header gets corrupted.
- Docx file with chart in footer/header or .bin file referred in chart was getting corrupted. - Embedded file for footer.xml was not grabbaged. - .bin embedded files were not grab baged. - Added grab bag support for both case. - Added UT to check .bin files are grab baged properly. Reviewed on: https://gerrit.libreoffice.org/8674 Change-Id: I221e3867798fc2a3a42f6385d687e80b80a3678f
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx39
-rw-r--r--chart2/qa/extras/data/docx/testchartoleobjectembeddings.docxbin0 -> 2041727 bytes
2 files changed, 39 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 5a57ea44bbb8..c0d20f17db36 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -52,6 +52,7 @@ public:
void testErrorBarDataRangeODS();
void testChartCrash();
void testPieChartRotation();
+ void testEmbeddingsOleObjectGrabBag();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(test);
@@ -76,6 +77,7 @@ public:
CPPUNIT_TEST(testErrorBarDataRangeODS);
CPPUNIT_TEST(testChartCrash);
CPPUNIT_TEST(testPieChartRotation);
+ CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag);
CPPUNIT_TEST_SUITE_END();
protected:
@@ -673,6 +675,43 @@ void Chart2ExportTest::testPieChartRotation()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:view3D/c:rotY", "val", "30");
}
+void Chart2ExportTest::testEmbeddingsOleObjectGrabBag()
+{
+ // The problem was that .bin files were missing from docx file from embeddings folder
+ // after saving file.
+ // This test case tests whether embeddings files grabbagged properly in correct object.
+
+ load("/chart2/qa/extras/data/docx/", "testchartoleobjectembeddings.docx" );
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aGrabBag(0);
+ xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
+ CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
+ bool bEmbeddings = false;
+ const char* testEmbeddedFileNames[1] = {"word/embeddings/oleObject1.bin"};
+ for(int i = 0; i < aGrabBag.getLength(); ++i)
+ {
+ if (aGrabBag[i].Name == "OOXEmbeddings")
+ {
+ bEmbeddings = true;
+ uno::Sequence<beans::PropertyValue> aEmbeddingsList(0);
+ uno::Reference<io::XInputStream> aEmbeddingXlsxStream;
+ OUString aEmbeddedfileName;
+ CPPUNIT_ASSERT(aGrabBag[i].Value >>= aEmbeddingsList); // PropertyValue of proper type
+ sal_Int32 length = aEmbeddingsList.getLength();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length);
+ for(int j = 0; j < length; ++j)
+ {
+ aEmbeddingsList[j].Value >>= aEmbeddingXlsxStream;
+ aEmbeddedfileName = aEmbeddingsList[j].Name;
+ CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not empty
+ CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName);
+ }
+ }
+ }
+ CPPUNIT_ASSERT(bEmbeddings); // Grab Bag has all the expected elements
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx b/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx
new file mode 100644
index 000000000000..8167de7a35eb
--- /dev/null
+++ b/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx
Binary files differ