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

Unified Diff: tests/CodexTest.cpp

Issue 1703293002: Remove position from FrontBufferedStream (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix test_peeking_front_buffered_stream Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkFrontBufferedStream.cpp ('k') | tests/FrontBufferedStreamTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CodexTest.cpp
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 0bd58935daedbd75b31c7de874935f04a53fa180..ebdc0f5b7591eb038306e1047d18514f91fc0da1 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -11,6 +11,7 @@
#include "SkCodec.h"
#include "SkCodecImageGenerator.h"
#include "SkData.h"
+#include "SkFrontBufferedStream.h"
#include "SkImageDecoder.h"
#include "SkMD5.h"
#include "SkRandom.h"
@@ -180,7 +181,7 @@ static void check(skiatest::Reporter* r,
// Test full image decodes with SkCodec
SkMD5::Digest codecDigest;
- SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType);
+ const SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType);
SkBitmap bm;
SkCodec::Result expectedResult = isIncomplete ? SkCodec::kIncompleteInput : SkCodec::kSuccess;
test_codec(r, codec.get(), bm, info, size, expectedResult, &codecDigest, nullptr);
@@ -313,8 +314,8 @@ static void check(skiatest::Reporter* r,
&codecDigest);
}
- // Test SkCodecImageGenerator
if (!isIncomplete) {
+ // Test SkCodecImageGenerator
SkAutoTDelete<SkStream> stream(resource(path));
SkAutoTUnref<SkData> fullData(SkData::NewFromStream(stream, stream->getLength()));
SkAutoTDelete<SkImageGenerator> gen(SkCodecImageGenerator::NewFromEncodedCodec(fullData));
@@ -323,6 +324,16 @@ static void check(skiatest::Reporter* r,
SkAutoLockPixels autoLockPixels(bm);
REPORTER_ASSERT(r, gen->getPixels(info, bm.getPixels(), bm.rowBytes()));
compare_to_good_digest(r, codecDigest, bm);
+
+ // Test using SkFrontBufferedStream, as Android does
+ SkStream* bufferedStream = SkFrontBufferedStream::Create(new SkMemoryStream(fullData),
+ SkCodec::MinBufferedBytesNeeded());
+ REPORTER_ASSERT(r, bufferedStream);
+ codec.reset(SkCodec::NewFromStream(bufferedStream));
+ REPORTER_ASSERT(r, codec);
+ if (codec) {
+ test_info(r, codec.get(), info, SkCodec::kSuccess, &codecDigest);
+ }
}
// If we've just tested incomplete decodes, let's run the same test again on full decodes.
« no previous file with comments | « src/utils/SkFrontBufferedStream.cpp ('k') | tests/FrontBufferedStreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698