blob: 181f0f9f04ab9e96334a28223c34c2ff0f407d96 [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
msarett0e6274f2016-03-21 08:04:40 -070012DEF_TEST(ExifOrientation, r) {
Ben Wagner145dbcd2016-11-03 14:40:50 -040013 std::unique_ptr<SkStream> stream(GetResourceAsStream("exif-orientation-2-ur.jpg"));
msarett0e6274f2016-03-21 08:04:40 -070014 REPORTER_ASSERT(r, nullptr != stream);
Brian Salomon92271fc2016-03-25 21:38:09 -040015 if (!stream) {
16 return;
17 }
18
Mike Reedede7bac2017-07-23 15:30:02 -040019 std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream)));
msarett0e6274f2016-03-21 08:04:40 -070020 REPORTER_ASSERT(r, nullptr != codec);
21 SkCodec::Origin origin = codec->getOrigin();
22 REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin);
23
Mike Reedede7bac2017-07-23 15:30:02 -040024 codec = SkCodec::MakeFromStream(GetResourceAsStream("mandrill_512_q075.jpg"));
msarett0e6274f2016-03-21 08:04:40 -070025 REPORTER_ASSERT(r, nullptr != codec);
26 origin = codec->getOrigin();
27 REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin);
28}