Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp

Issue 2618633004: Add support for Animated PNG (Closed)
Patch Set: Respond to comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 premulFrame = premulDecoder->frameBufferAtIndex(0); 399 premulFrame = premulDecoder->frameBufferAtIndex(0);
400 EXPECT_TRUE(premulFrame && 400 EXPECT_TRUE(premulFrame &&
401 premulFrame->getStatus() == ImageFrame::FrameComplete); 401 premulFrame->getStatus() == ImageFrame::FrameComplete);
402 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); 402 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType);
403 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0); 403 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0);
404 EXPECT_TRUE(unpremulFrame && 404 EXPECT_TRUE(unpremulFrame &&
405 unpremulFrame->getStatus() == ImageFrame::FrameComplete); 405 unpremulFrame->getStatus() == ImageFrame::FrameComplete);
406 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); 406 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType);
407 } 407 }
408 408
409 // Ensure that calling setMemoryAllocator does not short-circuit
410 // initializeNewFrame.
411 TEST(GIFImageDecoderTest, externalAllocator) {
412 auto data = readFile(layoutTestResourcesDir, "boston.gif");
413 ASSERT_TRUE(data.get());
414
415 auto decoder = createDecoder();
416 decoder->setData(data.get(), true);
417
418 SkBitmap::HeapAllocator allocator;
419 decoder->setMemoryAllocator(&allocator);
420 EXPECT_EQ(1u, decoder->frameCount());
421 ImageFrame* frame = decoder->frameBufferAtIndex(0);
422 decoder->setMemoryAllocator(nullptr);
423
424 ASSERT_TRUE(frame);
425 EXPECT_EQ(IntRect(IntPoint(), decoder->size()), frame->originalFrameRect());
426 EXPECT_FALSE(frame->hasAlpha());
427 }
428
409 } // namespace blink 429 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698