[Libreoffice-commits] core.git: sw/CppunitTest_sw_odfexport.mk sw/qa
Varun
varun.dhall at studentpartner.com
Mon Jul 27 09:31:16 PDT 2015
sw/CppunitTest_sw_odfexport.mk | 6 ++++
sw/qa/extras/odfexport/data/oooxml_embedded.sxw |binary
sw/qa/extras/odfexport/odfexport.cxx | 36 ++++++++++++++++++++++++
3 files changed, 42 insertions(+)
New commits:
commit e6ff477536ce64631ee10f769a69cc73ae7b456a
Author: Varun <varun.dhall at studentpartner.com>
Date: Mon Jul 27 21:15:50 2015 +0530
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 at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk
index 7bc7ed8..5edd9b5 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
new file mode 100644
index 0000000..e4fe14a
Binary files /dev/null and b/sw/qa/extras/odfexport/data/oooxml_embedded.sxw differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 9de166c..85a4c01 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
More information about the Libreoffice-commits
mailing list