summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-03-09 12:54:40 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-03-13 09:47:48 +0100
commita9bdb74c0309fca470abdaabbddea84798cbaa83 (patch)
tree48f95c682f6cf36da8cf93a38665abe74cd41b15 /vcl/qa/cppunit
parentd5e215289b816742ed7a6d423565bf1d59a1d117 (diff)
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@collabora.com>
Diffstat (limited to 'vcl/qa/cppunit')
-rw-r--r--vcl/qa/cppunit/png/PngFilterTest.cxx17
-rw-r--r--vcl/qa/cppunit/png/data/ms-gif.pngbin0 -> 15901 bytes
2 files changed, 17 insertions, 0 deletions
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
--- /dev/null
+++ b/vcl/qa/cppunit/png/data/ms-gif.png
Binary files differ