aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FrontBufferedStreamTest.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-03-01 12:12:27 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-01 12:12:27 -0800
commit7f7ec206de39fde8dc490e9feb0f65322af1b989 (patch)
tree03bcf8f57a63d0c1039b853679e65cdbad613507 /tests/FrontBufferedStreamTest.cpp
parent4a98cdb7612493a062358cebd1141c9bcaa37ab1 (diff)
Fix bug in SkGifCodec / Switch SkImageDec tests to use Codec
SkImageDecoder is still used throughout tests, tools, gms etc. Deleting it from tests is an easy first step. Bonus is that we add tests of SkCodec. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1733863003 Review URL: https://codereview.chromium.org/1733863003
Diffstat (limited to 'tests/FrontBufferedStreamTest.cpp')
-rw-r--r--tests/FrontBufferedStreamTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index 7821c5e40d..e3df466fd3 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -6,8 +6,8 @@
*/
#include "SkBitmap.h"
+#include "SkCodec.h"
#include "SkFrontBufferedStream.h"
-#include "SkImageDecoder.h"
#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTypes.h"
@@ -289,11 +289,9 @@ private:
DEF_TEST(ShortFrontBufferedStream, reporter) {
FailingStream* failingStream = new FailingStream;
SkAutoTDelete<SkStreamRewindable> stream(SkFrontBufferedStream::Create(failingStream, 64));
- SkBitmap bm;
- // The return value of DecodeStream is not important. We are just using DecodeStream because
- // it simulates a bug. DecodeStream will read the stream, then rewind, then attempt to read
- // again. FrontBufferedStream::read should not continue to read its underlying stream beyond
- // its end.
- SkImageDecoder::DecodeStream(stream, &bm);
+
+ // This will fail to create a codec. However, what we really want to test is that we
+ // won't read past the end of the stream.
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
REPORTER_ASSERT(reporter, !failingStream->readAfterEnd());
}