[Libreoffice-commits] core.git: Branch 'feature/image_rework' - 3 commits - sc/qa sd/qa sw/CppunitTest_sw_globalfilter.mk sw/Module_sw.mk sw/qa

Zolnai Tamás tamas.zolnai at collabora.com
Mon Oct 27 01:45:30 PDT 2014


 sc/qa/unit/data/ods/document_with_an_image.ods            |binary
 sc/qa/unit/subsequent_export-test.cxx                     |   72 ++++++++
 sd/qa/unit/data/odp/document_with_an_image.odp            |binary
 sd/qa/unit/export-tests.cxx                               |   70 ++++++++
 sw/CppunitTest_sw_globalfilter.mk                         |   90 ++++++++++
 sw/Module_sw.mk                                           |    1 
 sw/qa/extras/globalfilter/data/document_with_an_image.odt |binary
 sw/qa/extras/globalfilter/globalfilter.cxx                |  120 ++++++++++++++
 8 files changed, 353 insertions(+)

New commits:
commit 002b1dc2f3bfe2360f8fe368d93f7c7a8b4a4155
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sat Oct 25 18:21:40 2014 +0200

    Test for swapped out image loss during Calc export
    
    Related to the bug fdo#52226.
    The problem was that the images were somehow swapped out but
    were not swapped in during export.
    Test the main Calc formats: ODS, XLS, XLSX, HTML.
    
    Change-Id: I4835ff2960fbd11cc9750ed3da20df26cd6cbaba

diff --git a/sc/qa/unit/data/ods/document_with_an_image.ods b/sc/qa/unit/data/ods/document_with_an_image.ods
new file mode 100644
index 0000000..adfcd4c
Binary files /dev/null and b/sc/qa/unit/data/ods/document_with_an_image.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 988ed34..9e058b2 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -42,6 +42,8 @@
 #include <dputil.hxx>
 
 #include <svx/svdoole2.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdograf.hxx>
 #include "tabprotection.hxx"
 #include <editeng/wghtitem.hxx>
 #include <editeng/postitem.hxx>
@@ -62,6 +64,10 @@
 #include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -124,6 +130,7 @@ public:
 
     void testPivotTableXLSX();
     void testPivotTableTwoDataFieldsXLSX();
+    void testSwappedOutImageExport();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -164,6 +171,7 @@ public:
     CPPUNIT_TEST(testPivotTableXLSX);
     CPPUNIT_TEST(testPivotTableTwoDataFieldsXLSX);
     CPPUNIT_TEST(testFunctionsExcel2010ODS);
+    CPPUNIT_TEST(testSwappedOutImageExport);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2250,6 +2258,70 @@ void ScExportTest::testFunctionsExcel2010ODS()
     //testFunctionsExcel2010(ODS);
 }
 
+void ScExportTest::testSwappedOutImageExport()
+{
+    std::vector<OUString> aFilterNames = {
+        "calc8",
+        "MS Excel 97",
+        "Calc Office Open XML",
+        "generic_HTML",
+    };
+
+    for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
+    {
+        // Check whether the export code swaps in the image which was swapped out before.
+        ScDocShellRef xDocSh = loadDoc("document_with_an_image.", ODS);
+
+        const OString sFailedMessage = OString("Failed on filter: ")
+                                       + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
+
+        // Find and swap out the image
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.Is());
+        ScDocument* pDoc = &xDocSh->GetDocument();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
+        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDrawLayer);
+        const SdrPage* pPage = pDrawLayer->GetPage(0);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pPage);
+        const SdrObject* pObj = pPage->GetObj(0);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pObj->GetObjIdentifier() == OBJ_GRAF);
+        const SdrGrafObj& rGrafObj = static_cast<const SdrGrafObj&>(*pObj);
+        rGrafObj.ForceSwapOut();
+
+        // Export the document and import again for a check
+        ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter);
+        xDocSh->DoClose();
+
+        // Check whether graphic exported well after it was swapped out
+        uno::Reference< frame::XModel > xModel = xDocSh2->GetModel();
+        uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, UNO_QUERY_THROW);
+        uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+        uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW);
+        uno::Reference< container::XIndexAccess > xDraws(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(1), xDraws->getCount());
+
+        uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
+        uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:10000000000002620000017D9F4CD7A2"), sURL);
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
+        }
+        xDocSh2->DoClose();
+    }
+}
+
 ScExportTest::ScExportTest()
       : ScBootstrapFixture("/sc/qa/unit/data")
 {
commit ded127b210708a833c003c8d6fc017a571b839f5
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Oct 27 09:41:00 2014 +0100

    Test for swapped out image loss during Writer export
    
    Related to the bug fdo#52226. The fix in *.rtf and *.docx
    export was this commit:
    9dd5caac62083f7162d83319284df68ee83e3777
    The problem was that the images were somehow swapped out but
    were not swapped in during export.
    Test the main Writer formats: ODT, RTF, DOC, DOCX, HTML.
    
    Change-Id: I8ea142fa997c098b74fec264cda6b5fb5a547852

diff --git a/sw/CppunitTest_sw_globalfilter.mk b/sw/CppunitTest_sw_globalfilter.mk
new file mode 100644
index 0000000..96787c0
--- /dev/null
+++ b/sw/CppunitTest_sw_globalfilter.mk
@@ -0,0 +1,90 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_globalfilter, \
+    sw/qa/extras/globalfilter/globalfilter \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_globalfilter, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    sw \
+    test \
+    tl \
+    unotest \
+    utl \
+    vcl \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_globalfilter,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_globalfilter,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/qa/extras/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_globalfilter,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_globalfilter))
+$(eval $(call gb_CppunitTest_use_vcl,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_use_components,sw_globalfilter,\
+	basic/util/sb \
+	comphelper/util/comphelp \
+	configmgr/source/configmgr \
+	dbaccess/util/dba \
+	drawinglayer/drawinglayer \
+	embeddedobj/util/embobj \
+	filter/source/config/cache/filterconfig1 \
+	filter/source/storagefilterdetect/storagefd \
+	filter/source/textfilterdetect/textfd \
+	forms/util/frm \
+	framework/util/fwk \
+	i18npool/util/i18npool \
+	oox/util/oox \
+	package/source/xstor/xstor \
+	package/util/package2 \
+	sax/source/expatwrap/expwrap \
+	sfx2/util/sfx \
+	svl/source/fsstor/fsstorage \
+	svtools/util/svt \
+	sw/util/msword \
+	sw/util/sw \
+	sw/util/swd \
+	toolkit/util/tk \
+	ucb/source/core/ucb1 \
+	ucb/source/ucp/file/ucpfile1 \
+	unotools/util/utl \
+	unoxml/source/service/unoxml \
+	uui/util/uui \
+	$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+	writerfilter/util/writerfilter \
+	xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,sw_globalfilter))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index d205968..c5b5b8e 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_odfimport \
     CppunitTest_sw_uiwriter \
     CppunitTest_sw_mailmerge \
+    CppunitTest_sw_globalfilter \
 ))
 
 ifneq ($(DISABLE_CVE_TESTS),TRUE)
diff --git a/sw/qa/extras/globalfilter/data/document_with_an_image.odt b/sw/qa/extras/globalfilter/data/document_with_an_image.odt
new file mode 100644
index 0000000..ce7a29a
Binary files /dev/null and b/sw/qa/extras/globalfilter/data/document_with_an_image.odt differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
new file mode 100644
index 0000000..005ab66
--- /dev/null
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <ndgrf.hxx>
+
+class Test : public SwModelTestBase
+{
+public:
+    Test() : SwModelTestBase() {}
+
+    void testSwappedOutImageExport();
+
+    CPPUNIT_TEST_SUITE(Test);
+    CPPUNIT_TEST(testSwappedOutImageExport);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testSwappedOutImageExport()
+{
+    std::vector<OUString> aFilterNames = {
+        "writer8",
+        "Rich Text Format",
+        "MS Word 97",
+        "Office Open XML Text",
+        "HTML (StarWriter)",
+    };
+
+    for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
+    {
+        // Check whether the export code swaps in the image which was swapped out before.
+        if (mxComponent.is())
+            mxComponent->dispose();
+        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_an_image.odt"), "com.sun.star.text.TextDocument");
+
+        const OString sFailedMessage = OString("Failed on filter: ")
+                                       + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
+        SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTxtDoc);
+        SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
+        SwNodes& aNodes = pDoc->GetNodes();
+
+        // Find and swap out the image
+        bool bImageFound = false;
+        for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
+        {
+            if( aNodes[nIndex]->IsGrfNode() )
+            {
+                SwGrfNode* pGrfNode = aNodes[nIndex]->GetGrfNode();
+                pGrfNode->SwapOut();
+                bImageFound = true;
+            }
+        }
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), bImageFound);
+
+        // Export the document and import again for a check
+        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+
+        utl::MediaDescriptor aMediaDescriptor;
+        aMediaDescriptor["FilterName"] <<= aFilterNames[nFilter];
+
+        utl::TempFile aTempFile;
+        aTempFile.EnableKillingFile();
+        xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+        uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY);
+        xComponent->dispose();
+        mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
+
+        // Check whether graphic exported well after it was swapped out
+        uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(1), xDraws->getCount());
+
+        uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
+        uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            // HTML filter changes the name, but the real indicater here is the "null" URL.
+            if( aFilterNames[nFilter] == "HTML (StarWriter)" )
+            {
+                CPPUNIT_ASSERT_MESSAGE(
+                    sFailedMessage.getStr(), sURL != OUString("vnd.sun.star.GraphicObject:00000000000000000000000000000000"));
+            }
+            else
+            {
+                CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:10000000000002620000017D9F4CD7A2"), sURL);
+            }
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
+        }
+    }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
commit 2ee28982659e753b51bcf803436f29e32edd4ec3
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sat Oct 25 17:30:24 2014 +0200

    Test for swapped out image loss during Impress export
    
    Related to the bug fdo#52226.
    The problem was that the images were somehow swapped out but
    were not swapped in during export.
    Test the main Impress formats: ODP, PPT, PPTX
    
    Change-Id: I97ba98d0eb05ef2c1de3fbeaa527bc9f6f54d742

diff --git a/sd/qa/unit/data/odp/document_with_an_image.odp b/sd/qa/unit/data/odp/document_with_an_image.odp
new file mode 100644
index 0000000..9e0bdce
Binary files /dev/null and b/sd/qa/unit/data/odp/document_with_an_image.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 61aead3..780240b 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -35,6 +35,8 @@
 #include <svx/svdoole2.hxx>
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
+#include <unotools/mediadescriptor.hxx>
+#include <rtl/ustring.hxx>
 
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -50,6 +52,9 @@
 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
 #include <com/sun/star/chart2/data/XDataSequence.hpp>
 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
 
 #include <config_features.h>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -71,6 +76,7 @@ public:
     void testBnc862510_5();
     void testBnc822347_EmptyBullet();
     void testFdo83751();
+    void testSwappedOutImageExport();
 
     CPPUNIT_TEST_SUITE(SdExportTest);
     CPPUNIT_TEST(testN821567);
@@ -85,6 +91,7 @@ public:
     CPPUNIT_TEST(testBnc862510_5);
     CPPUNIT_TEST(testBnc822347_EmptyBullet);
     CPPUNIT_TEST(testFdo83751);
+    CPPUNIT_TEST(testSwappedOutImageExport);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -477,6 +484,69 @@ void SdExportTest::testFdo83751()
     xDocShRef->DoClose();
 }
 
+void SdExportTest::testSwappedOutImageExport()
+{
+    // Problem was with the swapped out images, which were not swapped in during export.
+    static const std::vector<sal_Int32> vFormats = {
+        ODP,
+        PPT,
+        PPTX,
+    };
+
+    for( size_t nExportFormat = 0; nExportFormat < vFormats.size(); ++nExportFormat )
+    {
+        // Load the original file with one image
+        ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_an_image.odp"), ODP);
+        const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[nExportFormat].pFilterName);
+
+        // Swap out the image
+        SdDrawDocument *pDoc = xDocShRef->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != NULL );
+        const SdrPage* pPage = pDoc->GetPage(1);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL );
+        SdrGrafObj* pGrafObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pGrafObject != NULL);
+        pGrafObject->ForceSwapOut();
+
+        // Export the document and import again for a check
+        uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
+        uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
+        utl::MediaDescriptor aMediaDescriptor;
+        aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8);
+
+        utl::TempFile aTempFile;
+        aTempFile.EnableKillingFile();
+        xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+        xComponent.set(xStorable, uno::UNO_QUERY);
+        xComponent->dispose();
+        xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
+
+        // Check whether graphic exported well after it was swapped out
+        uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), xDrawPagesSupplier->getDrawPages()->getCount() == 1 );
+        uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+        uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
+        uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:10000000000002620000017D9F4CD7A2"), sURL);
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
+        }
+        xDocShRef->DoClose();
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list