OLD | NEW |
---|---|
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposa l-method.gif"); | 492 RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposa l-method.gif"); |
493 ASSERT_TRUE(data.get()); | 493 ASSERT_TRUE(data.get()); |
494 decoder->setData(data.get(), true); | 494 decoder->setData(data.get(), true); |
495 | 495 |
496 EXPECT_EQ(2u, decoder->frameCount()); | 496 EXPECT_EQ(2u, decoder->frameCount()); |
497 // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious. | 497 // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious. |
498 EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex( 0)->disposalMethod()); | 498 EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex( 0)->disposalMethod()); |
499 // Disposal method 5 is ignored. | 499 // Disposal method 5 is ignored. |
500 EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->d isposalMethod()); | 500 EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->d isposalMethod()); |
501 } | 501 } |
502 | |
503 TEST(GIFImageDecoderTest, firstFrameHasGreaterSizeThanScreenSize) | |
504 { | |
505 RefPtr<SharedBuffer> fullData = readFile("/Source/platform/image-decoders/te sting/first-frame-has-greater-size-than-screen-size.gif"); | |
Stephen White
2015/01/14 22:17:02
Not new to this CL, but we should probably shorten
Alpha Left Google
2015/01/14 23:14:59
Done.
| |
506 ASSERT_TRUE(fullData.get()); | |
507 | |
508 OwnPtr<GIFImageDecoder> decoder; | |
509 IntSize frameSize; | |
510 | |
511 // Compute hashes when the file is truncated. | |
512 for (size_t i = 1; i <= fullData->size(); ++i) { | |
513 decoder = createDecoder(); | |
514 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i); | |
515 decoder->setData(data.get(), i == fullData->size()); | |
516 | |
517 if (decoder->isSizeAvailable() && !frameSize.width() && !frameSize.heigh t()) { | |
518 frameSize = decoder->decodedSize(); | |
519 continue; | |
520 } | |
521 | |
522 ASSERT_EQ(frameSize.width(), decoder->decodedSize().width()); | |
523 ASSERT_EQ(frameSize.height(), decoder->decodedSize().height()); | |
524 } | |
525 } | |
OLD | NEW |