diff options
author | umeshkadam <umesh.kadam@synerzip.com> | 2014-04-21 19:46:00 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-27 18:14:53 +0000 |
commit | 825265f093a844f952d0dd64e5b4de9a1aba3185 (patch) | |
tree | 9f8dc4bfaefde62d5f75e057db8dccdb564e7b60 /sw/qa | |
parent | dfbaef22fcc66f86ecdfccb82037fbfd171c975d (diff) |
fdo#77718: Picture inside SmartArt changes after RT
- The image data stream for the targets of relId's were getting overwritten,
therefore the data was getting loss.
- Added anchor id as part of computing a unique name for images.
- Added UT for the same.
Change-Id: I999ba1b3701ef357641dd0365403a5d7ad8d18aa
Reviewed-on: https://gerrit.libreoffice.org/9121
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo77718.docx | bin | 0 -> 554994 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 34 |
2 files changed, 33 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77718.docx b/sw/qa/extras/ooxmlexport/data/fdo77718.docx Binary files differnew file mode 100644 index 000000000000..7a22485f7644 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo77718.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 631f415d2c86..31fd36badc1e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2748,11 +2748,43 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx") comphelper::getComponentContext(m_xSFactory), m_aTempFile.GetURL()); //check that images are also saved - OUString sImageFile( "word/media/OOXDiagramDataRels0.jpeg" ); + OUString sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( sImageFile ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream.is() ); } +DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx") +{ + //in case of multiple smart arts the names for images were getting + //repeated and thereby causing a data loss as the binary stream was + //getting over written. This test case ensures that unique names are + //given for images in different smart arts. + xmlDocPtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels"); + if( !pXmlDataRels1 ) + return; + + xmlDocPtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels"); + if( !pXmlDataRels2 ) + return; + + //ensure that the rels file is present. + assertXPath(pXmlDataRels1,"/rels:Relationships/rels:Relationship", 4); + assertXPath(pXmlDataRels2,"/rels:Relationships/rels:Relationship", 4); + + uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL( + comphelper::getComponentContext(m_xSFactory), m_aTempFile.GetURL()); + + //check that images are also saved + OUString sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name + uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( sImageFile1 ), uno::UNO_QUERY); + CPPUNIT_ASSERT( xInputStream1.is() ); + + //check that images are saved for other smart-arts as well. + OUString sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a uniqe name + uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( sImageFile2 ), uno::UNO_QUERY); + CPPUNIT_ASSERT( xInputStream2.is() ); +} + DECLARE_OOXMLEXPORT_TEST(testTableCurruption, "tableCurrupt.docx") { xmlDocPtr pXmlDoc = parseExport("word/header4.xml"); |