From a9bdb74c0309fca470abdaabbddea84798cbaa83 Mon Sep 17 00:00:00 2001 From: Luboš Luňák <l.lunak@collabora.com> Date: Tue, 9 Mar 2021 12:54:40 +0100 Subject: test gif-in-png Microsoft extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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@collabora.com> --- vcl/qa/cppunit/png/PngFilterTest.cxx | 17 +++++++++++++++++ vcl/qa/cppunit/png/data/ms-gif.png | Bin 0 -> 15901 bytes 2 files changed, 17 insertions(+) create mode 100644 vcl/qa/cppunit/png/data/ms-gif.png (limited to 'vcl/qa/cppunit') 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 -- cgit