2016-03-21 15:04:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/codec/SkCodec.h"
|
|
|
|
#include "tests/Test.h"
|
|
|
|
#include "tools/Resources.h"
|
2016-03-21 15:04:40 +00:00
|
|
|
|
|
|
|
DEF_TEST(ExifOrientation, r) {
|
2017-12-08 15:21:31 +00:00
|
|
|
std::unique_ptr<SkStream> stream(GetResourceAsStream("images/exif-orientation-2-ur.jpg"));
|
2016-03-21 15:04:40 +00:00
|
|
|
REPORTER_ASSERT(r, nullptr != stream);
|
2016-03-26 01:38:09 +00:00
|
|
|
if (!stream) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-23 19:30:02 +00:00
|
|
|
std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream)));
|
2016-03-21 15:04:40 +00:00
|
|
|
REPORTER_ASSERT(r, nullptr != codec);
|
2017-10-18 18:42:43 +00:00
|
|
|
SkEncodedOrigin origin = codec->getOrigin();
|
|
|
|
REPORTER_ASSERT(r, kTopRight_SkEncodedOrigin == origin);
|
2016-03-21 15:04:40 +00:00
|
|
|
|
2017-12-08 15:21:31 +00:00
|
|
|
codec = SkCodec::MakeFromStream(GetResourceAsStream("images/mandrill_512_q075.jpg"));
|
2016-03-21 15:04:40 +00:00
|
|
|
REPORTER_ASSERT(r, nullptr != codec);
|
|
|
|
origin = codec->getOrigin();
|
2017-10-18 18:42:43 +00:00
|
|
|
REPORTER_ASSERT(r, kTopLeft_SkEncodedOrigin == origin);
|
2016-03-21 15:04:40 +00:00
|
|
|
}
|