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

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

Issue 2385993002: Rewrap comments to 80 columns in Source/platform/image-decoders/. (Closed)
Patch Set: Rewrite comment Created 4 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_EQ(1u, frameBuffers[3].requiredPreviousFrameIndex()); 101 EXPECT_EQ(1u, frameBuffers[3].requiredPreviousFrameIndex());
102 EXPECT_EQ(1u, frameBuffers[4].requiredPreviousFrameIndex()); 102 EXPECT_EQ(1u, frameBuffers[4].requiredPreviousFrameIndex());
103 EXPECT_EQ(4u, frameBuffers[5].requiredPreviousFrameIndex()); 103 EXPECT_EQ(4u, frameBuffers[5].requiredPreviousFrameIndex());
104 } 104 }
105 105
106 TEST(ImageDecoderTest, requiredPreviousFrameIndexDisposeOverwriteBgcolor) { 106 TEST(ImageDecoderTest, requiredPreviousFrameIndexDisposeOverwriteBgcolor) {
107 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); 107 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder()));
108 decoder->initFrames(3); 108 decoder->initFrames(3);
109 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); 109 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache();
110 110
111 // Fully covering DisposeOverwriteBgcolor previous frame resets the starting s tate. 111 // Fully covering DisposeOverwriteBgcolor previous frame resets the starting
112 // state.
112 frameBuffers[1].setDisposalMethod(ImageFrame::DisposeOverwriteBgcolor); 113 frameBuffers[1].setDisposalMethod(ImageFrame::DisposeOverwriteBgcolor);
113 decoder->resetRequiredPreviousFrames(); 114 decoder->resetRequiredPreviousFrames();
114 EXPECT_EQ(kNotFound, frameBuffers[2].requiredPreviousFrameIndex()); 115 EXPECT_EQ(kNotFound, frameBuffers[2].requiredPreviousFrameIndex());
115 116
116 // Partially covering DisposeOverwriteBgcolor previous frame is required by th is frame. 117 // Partially covering DisposeOverwriteBgcolor previous frame is required by
118 // this frame.
117 frameBuffers[1].setOriginalFrameRect(IntRect(50, 50, 50, 50)); 119 frameBuffers[1].setOriginalFrameRect(IntRect(50, 50, 50, 50));
118 decoder->resetRequiredPreviousFrames(); 120 decoder->resetRequiredPreviousFrames();
119 EXPECT_EQ(1u, frameBuffers[2].requiredPreviousFrameIndex()); 121 EXPECT_EQ(1u, frameBuffers[2].requiredPreviousFrameIndex());
120 } 122 }
121 123
122 TEST(ImageDecoderTest, requiredPreviousFrameIndexForFrame1) { 124 TEST(ImageDecoderTest, requiredPreviousFrameIndexForFrame1) {
123 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); 125 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder()));
124 decoder->initFrames(2); 126 decoder->initFrames(2);
125 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); 127 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache();
126 128
(...skipping 21 matching lines...) Expand all
148 } 150 }
149 151
150 TEST(ImageDecoderTest, requiredPreviousFrameIndexBlendAtopBgcolor) { 152 TEST(ImageDecoderTest, requiredPreviousFrameIndexBlendAtopBgcolor) {
151 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); 153 std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder()));
152 decoder->initFrames(3); 154 decoder->initFrames(3);
153 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); 155 Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache();
154 156
155 frameBuffers[1].setOriginalFrameRect(IntRect(25, 25, 50, 50)); 157 frameBuffers[1].setOriginalFrameRect(IntRect(25, 25, 50, 50));
156 frameBuffers[2].setAlphaBlendSource(ImageFrame::BlendAtopBgcolor); 158 frameBuffers[2].setAlphaBlendSource(ImageFrame::BlendAtopBgcolor);
157 159
158 // A full frame with 'blending method == BlendAtopBgcolor' doesn't depend on a ny prior frames. 160 // A full frame with 'blending method == BlendAtopBgcolor' doesn't depend on
161 // any prior frames.
159 for (int disposeMethod = ImageFrame::DisposeNotSpecified; 162 for (int disposeMethod = ImageFrame::DisposeNotSpecified;
160 disposeMethod <= ImageFrame::DisposeOverwritePrevious; ++disposeMethod) { 163 disposeMethod <= ImageFrame::DisposeOverwritePrevious; ++disposeMethod) {
161 frameBuffers[1].setDisposalMethod( 164 frameBuffers[1].setDisposalMethod(
162 static_cast<ImageFrame::DisposalMethod>(disposeMethod)); 165 static_cast<ImageFrame::DisposalMethod>(disposeMethod));
163 decoder->resetRequiredPreviousFrames(); 166 decoder->resetRequiredPreviousFrames();
164 EXPECT_EQ(kNotFound, frameBuffers[2].requiredPreviousFrameIndex()); 167 EXPECT_EQ(kNotFound, frameBuffers[2].requiredPreviousFrameIndex());
165 } 168 }
166 169
167 // A non-full frame with 'blending method == BlendAtopBgcolor' does depend on a prior frame. 170 // A non-full frame with 'blending method == BlendAtopBgcolor' does depend on
171 // a prior frame.
168 frameBuffers[2].setOriginalFrameRect(IntRect(50, 50, 50, 50)); 172 frameBuffers[2].setOriginalFrameRect(IntRect(50, 50, 50, 50));
169 for (int disposeMethod = ImageFrame::DisposeNotSpecified; 173 for (int disposeMethod = ImageFrame::DisposeNotSpecified;
170 disposeMethod <= ImageFrame::DisposeOverwritePrevious; ++disposeMethod) { 174 disposeMethod <= ImageFrame::DisposeOverwritePrevious; ++disposeMethod) {
171 frameBuffers[1].setDisposalMethod( 175 frameBuffers[1].setDisposalMethod(
172 static_cast<ImageFrame::DisposalMethod>(disposeMethod)); 176 static_cast<ImageFrame::DisposalMethod>(disposeMethod));
173 decoder->resetRequiredPreviousFrames(); 177 decoder->resetRequiredPreviousFrames();
174 EXPECT_NE(kNotFound, frameBuffers[2].requiredPreviousFrameIndex()); 178 EXPECT_NE(kNotFound, frameBuffers[2].requiredPreviousFrameIndex());
175 } 179 }
176 } 180 }
177 181
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 for (size_t i = 0; i < numFrames; ++i) { 245 for (size_t i = 0; i < numFrames; ++i) {
242 SCOPED_TRACE(testing::Message() << i); 246 SCOPED_TRACE(testing::Message() << i);
243 if (i == 5) 247 if (i == 5)
244 EXPECT_EQ(ImageFrame::FrameComplete, frameBuffers[i].getStatus()); 248 EXPECT_EQ(ImageFrame::FrameComplete, frameBuffers[i].getStatus());
245 else 249 else
246 EXPECT_EQ(ImageFrame::FrameEmpty, frameBuffers[i].getStatus()); 250 EXPECT_EQ(ImageFrame::FrameEmpty, frameBuffers[i].getStatus());
247 } 251 }
248 } 252 }
249 253
250 } // namespace blink 254 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698