[Libreoffice-commits] core.git: vcl/qa

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Sat Mar 13 08:48:29 UTC 2021


 vcl/qa/cppunit/png/PngFilterTest.cxx |   17 +++++++++++++++++
 vcl/qa/cppunit/png/data/ms-gif.png   |binary
 2 files changed, 17 insertions(+)

New commits:
commit a9bdb74c0309fca470abdaabbddea84798cbaa83
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Mar 9 12:54:40 2021 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Mar 13 09:47:48 2021 +0100

    test gif-in-png Microsoft extension
    
    Based on document from tdf#92643.
    
    Change-Id: I0837562da121e805d011f88ffe4a678e75ca441c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112202
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx
index 28e6c719f6fd..3b02e1135504 100644
--- a/vcl/qa/cppunit/png/PngFilterTest.cxx
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -26,6 +26,7 @@
 #include <vcl/filter/PngImageReader.hxx>
 #include <vcl/BitmapReadAccess.hxx>
 #include <vcl/alpha.hxx>
+#include <vcl/graphicfilter.hxx>
 
 using namespace css;
 
@@ -46,9 +47,11 @@ public:
     }
 
     void testPng();
+    void testMsGifInPng();
 
     CPPUNIT_TEST_SUITE(PngFilterTest);
     CPPUNIT_TEST(testPng);
+    CPPUNIT_TEST(testMsGifInPng);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -222,6 +225,20 @@ void PngFilterTest::testPng()
     }
 }
 
+void PngFilterTest::testMsGifInPng()
+{
+    Graphic aGraphic;
+    const OUString aURL(getFullUrl(u"ms-gif.png"));
+    SvFileStream aFileStream(aURL, StreamMode::READ);
+    GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
+    ErrCode aResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
+    CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, aResult);
+    CPPUNIT_ASSERT(aGraphic.IsGfxLink());
+    // The image is technically a PNG, but it has an animated Gif as a chunk (Microsoft extension).
+    CPPUNIT_ASSERT_EQUAL(GfxLinkType::NativeGif, aGraphic.GetSharedGfxLink()->GetType());
+    CPPUNIT_ASSERT(aGraphic.IsAnimated());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(PngFilterTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/qa/cppunit/png/data/ms-gif.png b/vcl/qa/cppunit/png/data/ms-gif.png
new file mode 100644
index 000000000000..1f683241f53f
Binary files /dev/null and b/vcl/qa/cppunit/png/data/ms-gif.png differ


More information about the Libreoffice-commits mailing list