skia2/tests/ExifTest.cpp
Mike Reed ede7bac43f use unique_ptr for codec factories
Will need guards for android (at least)

Bug: skia:
Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947
Reviewed-on: https://skia-review.googlesource.com/26040
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-25 15:35:23 +00:00

29 lines
865 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Resources.h"
#include "SkCodec.h"
#include "Test.h"
DEF_TEST(ExifOrientation, r) {
std::unique_ptr<SkStream> stream(GetResourceAsStream("exif-orientation-2-ur.jpg"));
REPORTER_ASSERT(r, nullptr != stream);
if (!stream) {
return;
}
std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream)));
REPORTER_ASSERT(r, nullptr != codec);
SkCodec::Origin origin = codec->getOrigin();
REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin);
codec = SkCodec::MakeFromStream(GetResourceAsStream("mandrill_512_q075.jpg"));
REPORTER_ASSERT(r, nullptr != codec);
origin = codec->getOrigin();
REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin);
}