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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Resources.h"
|
|
|
|
#include "SkCodec.h"
|
|
|
|
#include "Test.h"
|
|
|
|
|
2016-09-15 17:57:38 +00:00
|
|
|
static SkStreamAsset* resource(const char path[]) {
|
|
|
|
SkString fullPath = GetResourcePath(path);
|
|
|
|
return SkStream::NewFromFile(fullPath.c_str());
|
|
|
|
}
|
|
|
|
|
2016-03-21 15:04:40 +00:00
|
|
|
DEF_TEST(ExifOrientation, r) {
|
2016-09-15 17:57:38 +00:00
|
|
|
SkAutoTDelete<SkStream> stream(resource("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;
|
|
|
|
}
|
|
|
|
|
2016-03-21 15:04:40 +00:00
|
|
|
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
|
|
|
|
REPORTER_ASSERT(r, nullptr != codec);
|
|
|
|
SkCodec::Origin origin = codec->getOrigin();
|
|
|
|
REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin);
|
|
|
|
|
2016-09-15 17:57:38 +00:00
|
|
|
stream.reset(resource("mandrill_512_q075.jpg"));
|
2016-03-21 15:04:40 +00:00
|
|
|
codec.reset(SkCodec::NewFromStream(stream.release()));
|
|
|
|
REPORTER_ASSERT(r, nullptr != codec);
|
|
|
|
origin = codec->getOrigin();
|
|
|
|
REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin);
|
|
|
|
}
|