diff options
-rw-r--r-- | sw/CppunitTest_sw_odfexport.mk | 6 | ||||
-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 |
3 files changed, 42 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk index 7bc7ed826a14..5edd9b57329e 100644 --- a/sw/CppunitTest_sw_odfexport.mk +++ b/sw/CppunitTest_sw_odfexport.mk @@ -78,6 +78,12 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfexport,\ writerfilter/util/writerfilter \ $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \ xmloff/util/xo \ + chart2/source/chartcore \ + chart2/source/controller/chartcontroller \ + sc/util/sc \ + sd/util/sd \ + svx/util/svxcore \ + xmloff/source/transform/xof \ )) $(eval $(call gb_CppunitTest_use_custom_headers,sw_odfexport,\ 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 |