diff options
author | Paris Oplopoios <paris.oplopoios@collabora.com> | 2023-02-06 14:19:41 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-10 16:10:39 +0200 |
commit | bf944e33569e4a1d6236a54671b7320cdc6ffaf6 (patch) | |
tree | 682aa51909caed66065e36df17148f580196cf45 /vcl/qa/cppunit/png | |
parent | a7b5fe0c813977347a8d10ac5a52862f6150fbc0 (diff) |
tdf#104877 Add basic APNG format support
Add basic APNG (animated PNG) format support that can correctly display
simple files with no transparency
Change-Id: Ibfb6e13953a8ba48a535a40b08792b3723b7dc0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140089
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qa/cppunit/png')
-rw-r--r-- | vcl/qa/cppunit/png/PngFilterTest.cxx | 20 | ||||
-rw-r--r-- | vcl/qa/cppunit/png/data/apng_simple.apng | bin | 0 -> 239 bytes |
2 files changed, 20 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index fc3963c356e8..760e12f8b3fc 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -170,6 +170,7 @@ public: } void testPng(); + void testApng(); void testPngSuite(); void testMsGifInPng(); void testPngRoundtrip8BitGrey(); @@ -182,6 +183,7 @@ public: CPPUNIT_TEST_SUITE(PngFilterTest); CPPUNIT_TEST(testPng); + CPPUNIT_TEST(testApng); CPPUNIT_TEST(testPngSuite); CPPUNIT_TEST(testMsGifInPng); CPPUNIT_TEST(testPngRoundtrip8BitGrey); @@ -370,6 +372,24 @@ void PngFilterTest::testPng() } } +void PngFilterTest::testApng() +{ + SvFileStream aFileStream(getFullUrl(u"apng_simple.apng"), StreamMode::READ); + vcl::PngImageReader aPngReader(aFileStream); + Graphic aGraphic; + bool bSuccess = aPngReader.read(aGraphic); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT(aGraphic.IsAnimated()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aGraphic.GetAnimation().GetAnimationFrames().size()); + + auto aFrame1 = aGraphic.GetAnimation().GetAnimationFrames()[0]->maBitmapEx; + auto aFrame2 = aGraphic.GetAnimation().GetAnimationFrames()[1]->maBitmapEx; + + CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFrame1.GetPixelColor(0, 0)); + CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), aFrame1.GetPixelColor(2, 2)); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aFrame2.GetPixelColor(0, 0)); +} + void PngFilterTest::testPngSuite() { // Test the PngSuite test files by Willem van Schaik diff --git a/vcl/qa/cppunit/png/data/apng_simple.apng b/vcl/qa/cppunit/png/data/apng_simple.apng Binary files differnew file mode 100644 index 000000000000..445b7acaf4c8 --- /dev/null +++ b/vcl/qa/cppunit/png/data/apng_simple.apng |