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

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

Issue 25422003: Ignore unsupported disposal methods when decoding GIF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test Created 7 years, 2 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
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/gif/GIFImageReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 EXPECT_EQ(frameCount, decoder->frameCount()); 444 EXPECT_EQ(frameCount, decoder->frameCount());
445 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1); 445 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1);
446 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma p())); 446 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma p()));
447 decoder->clearCacheExceptFrame(kNotFound); 447 decoder->clearCacheExceptFrame(kNotFound);
448 448
449 // Resume decoding of the first frame. 449 // Resume decoding of the first frame.
450 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0); 450 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0);
451 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status()); 451 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
452 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap())); 452 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
453 } 453 }
454
455 TEST(GIFImageDecoderTest, invalidDisposalMethod)
456 {
457 OwnPtr<GIFImageDecoder> decoder = createDecoder();
458
459 // The image has 2 frames, with disposal method 4 and 5, respectively.
460 RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposa l-method.gif");
461 ASSERT_TRUE(data.get());
462 decoder->setData(data.get(), true);
463
464 EXPECT_EQ(2u, decoder->frameCount());
465 // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious.
466 EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex( 0)->disposalMethod());
467 // Disposal method 5 is ignored.
468 EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->d isposalMethod());
469 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/gif/GIFImageReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698