[Libreoffice-commits] core.git: 2 commits - sd/qa sd/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed May 23 11:39:39 UTC 2018


 sd/qa/unit/data/odp/BulletsAsImage.odp |binary
 sd/qa/unit/export-tests.cxx            |   54 +++++++++++++++++++++++++++++++--
 sd/source/filter/eppt/pptx-text.cxx    |    6 +++
 3 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit 82975bbc1a6acee97e3a90756909e424af03bc37
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed May 23 18:24:19 2018 +0900

    sd: extend bitmap bullet tests
    
    Change-Id: I169f7306f3af2c283b1c928230eaf6566b1a6660
    Reviewed-on: https://gerrit.libreoffice.org/54696
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sd/qa/unit/data/odp/BulletsAsImage.odp b/sd/qa/unit/data/odp/BulletsAsImage.odp
index 21d10e494829..7094d34af949 100644
Binary files a/sd/qa/unit/data/odp/BulletsAsImage.odp and b/sd/qa/unit/data/odp/BulletsAsImage.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index c6dd4a70741f..165d212fd956 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -944,14 +944,64 @@ void SdExportTest::testBulletsAsImage()
         uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY_THROW);
         uno::Sequence<beans::PropertyValue> aProperties;
         xLevels->getByIndex(0) >>= aProperties; // 1st level
+
         uno::Reference<awt::XBitmap> xBitmap;
-        for (const beans::PropertyValue& rProperty : aProperties)
+        awt::Size aSize;
+        sal_Int16 nNumberingType = -1;
+
+        for (beans::PropertyValue const & rProperty : aProperties)
         {
-            if (rProperty.Name == "GraphicBitmap")
+            if (rProperty.Name == "NumberingType")
+            {
+                nNumberingType = rProperty.Value.get<sal_Int16>();
+            }
+            else if (rProperty.Name == "GraphicBitmap")
+            {
                 xBitmap = rProperty.Value.get<uno::Reference<awt::XBitmap>>();
+            }
+            else if (rProperty.Name == "GraphicSize")
+            {
+                aSize = rProperty.Value.get<awt::Size>();
+            }
         }
+
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), style::NumberingType::BITMAP, nNumberingType);
+
+        // Graphic Bitmap
         const OString sFailed = sFailedMessageBase + "No bitmap for the bullets";
         CPPUNIT_ASSERT_MESSAGE(sFailed.getStr(), xBitmap.is());
+        Graphic aGraphic(uno::Reference<graphic::XGraphic>(xBitmap, uno::UNO_QUERY));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), GraphicType::Bitmap, aGraphic.GetType());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessageBase.getStr(), aGraphic.GetSizeBytes() > sal_uLong(0));
+
+        if (nExportFormat == ODP || nExportFormat == PPT)
+        {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, aGraphic.GetSizePixel().Width());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, aGraphic.GetSizePixel().Height());
+        }
+        else // FIXME: what happened here
+        {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, aGraphic.GetSizePixel().Width());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, aGraphic.GetSizePixel().Height());
+        }
+
+        // Graphic Size
+        if (nExportFormat == ODP)
+        {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(500), aSize.Width);
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(500), aSize.Height);
+
+        }
+        else if (nExportFormat == PPT) // seems like a conversion error
+        {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(504), aSize.Width);
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(504), aSize.Height);
+        }
+        else // FIXME: totally wrong
+        {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(790), aSize.Width);
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(790), aSize.Height);
+        }
 
         xDocShRef->DoClose();
     }
commit 15938ebbfa3a52595371a718f251137612184d21
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed May 23 18:23:31 2018 +0900

    sd: convert XGraphic to XBitmap for the "GraphicBitmap" property
    
    Change-Id: Idec08d4823775b11976f8650fe942f296d6dd4ce
    Reviewed-on: https://gerrit.libreoffice.org/54695
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 615cb15aad09..285c5e14a5fd 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/awt/CharSet.hpp>
 #include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 #include <com/sun/star/container/XIndexReplace.hpp>
@@ -846,7 +847,10 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
 
                     }
                     else if ( aPropName == "GraphicBitmap" )
-                        xGraphic = pPropValue[i].Value.get<uno::Reference<graphic::XGraphic>>();
+                    {
+                        auto xBitmap = pPropValue[i].Value.get<uno::Reference<awt::XBitmap>>();
+                        xGraphic.set(xBitmap, uno::UNO_QUERY);
+                    }
                     else if ( aPropName == "GraphicSize" )
                     {
                         if (auto aSize = o3tl::tryAccess<css::awt::Size>(pPropValue[i].Value))


More information about the Libreoffice-commits mailing list