blob: c49de0f6fe2ed9b2244a472d48306bce0f798558 [file] [log] [blame]
msarett0e6274f2016-03-21 08:04:40 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "Resources.h"
9#include "SkCodec.h"
10#include "Test.h"
11
12static SkStreamAsset* resource(const char path[]) {
13 SkString fullPath = GetResourcePath(path);
14 return SkStream::NewFromFile(fullPath.c_str());
15}
16
17DEF_TEST(ExifOrientation, r) {
18 SkAutoTDelete<SkStream> stream(resource("exif-orientation-2-ur.jpg"));
19 REPORTER_ASSERT(r, nullptr != stream);
20 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
21 REPORTER_ASSERT(r, nullptr != codec);
22 SkCodec::Origin origin = codec->getOrigin();
23 REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin);
24
25 stream.reset(resource("mandrill_512_q075.jpg"));
26 codec.reset(SkCodec::NewFromStream(stream.release()));
27 REPORTER_ASSERT(r, nullptr != codec);
28 origin = codec->getOrigin();
29 REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin);
30}