diff options
author | Varun <varun.dhall@studentpartner.com> | 2015-07-27 21:15:50 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-27 16:30:43 +0000 |
commit | e6ff477536ce64631ee10f769a69cc73ae7b456a (patch) | |
tree | aef09629181e9bcab58e88216664038d3fa6876a /sw/qa | |
parent | e83499ad82bee4c2255b47c16f877ec09eff5c35 (diff) |
Added Test for tdf#78159 OOoXML embedded objects should be converted to ODF
Change-Id: I84990fb07f1423b4365c428e6676271b045b2565
Reviewed-on: https://gerrit.libreoffice.org/17375
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/odfexport/data/oooxml_embedded.sxw | bin | 0 -> 21943 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 36 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/oooxml_embedded.sxw b/sw/qa/extras/odfexport/data/oooxml_embedded.sxw Binary files differnew file mode 100644 index 000000000000..e4fe14aef526 --- /dev/null +++ b/sw/qa/extras/odfexport/data/oooxml_embedded.sxw diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 9de166ca63cd..85a4c01b2d79 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -22,6 +22,10 @@ #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <officecfg/Office/Common.hxx> +#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> +#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> +#include <comphelper/storagehelper.hxx> +#include <comphelper/fileformat.h> class Test : public SwModelTestBase { @@ -197,6 +201,38 @@ DECLARE_ODFEXPORT_TEST(testFramebackgrounds, "framebackgrounds.odt") } } +DECLARE_ODFEXPORT_TEST(testOOoxmlEmbedded, "oooxml_embedded.sxw") +{ + uno::Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xAccess(xTEOSupplier->getEmbeddedObjects()); + uno::Sequence<OUString> aSeq(xAccess->getElementNames()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength()); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier1(xAccess->getByName("Object1"), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xObj1(xEOSupplier1->getEmbeddedObject()); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier2(xAccess->getByName("Object2"), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xObj2(xEOSupplier2->getEmbeddedObject()); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier3(xAccess->getByName("Object3"), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xObj3(xEOSupplier3->getEmbeddedObject()); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier4(xAccess->getByName("Object4"), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xObj4(xEOSupplier4->getEmbeddedObject()); + //checking first object + uno::Reference<document::XStorageBasedDocument> xSBDoc1(xObj1, uno::UNO_QUERY); + uno::Reference<embed::XStorage> xStorage1(xSBDoc1->getDocumentStorage()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8), comphelper::OStorageHelper::GetXStorageFormat(xStorage1)); + //checking second object + uno::Reference<document::XStorageBasedDocument> xSBDoc2(xObj2, uno::UNO_QUERY); + uno::Reference<embed::XStorage> xStorage2(xSBDoc2->getDocumentStorage()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8), comphelper::OStorageHelper::GetXStorageFormat(xStorage2)); + //checking third object + uno::Reference<document::XStorageBasedDocument> xSBDoc3(xObj3, uno::UNO_QUERY); + uno::Reference<embed::XStorage> xStorage3(xSBDoc3->getDocumentStorage()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8), comphelper::OStorageHelper::GetXStorageFormat(xStorage3)); + //checking fourth object + uno::Reference<document::XStorageBasedDocument> xSBDoc4(xObj4, uno::UNO_QUERY); + uno::Reference<embed::XStorage> xStorage4(xSBDoc4->getDocumentStorage()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8), comphelper::OStorageHelper::GetXStorageFormat(xStorage4)); +} + DECLARE_ODFEXPORT_TEST(testredlineTextFrame, "redlineTextFrame.odt") { //Note this is for a crash test |