blob: ff83f1a1c46665b2c6cdeee1ce8b2a5378b8487b [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "include/codec/SkCodec.h"
9#include "tests/Test.h"
10#include "tools/Resources.h"
msarett0e6274f2016-03-21 08:04:40 -070011
msarett0e6274f2016-03-21 08:04:40 -070012DEF_TEST(ExifOrientation, r) {
Hal Canaryc465d132017-12-08 10:21:31 -050013 std::unique_ptr<SkStream> stream(GetResourceAsStream("images/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);
Leon Scroggins IIIb6ab10f2017-10-18 14:42:43 -040021 SkEncodedOrigin origin = codec->getOrigin();
22 REPORTER_ASSERT(r, kTopRight_SkEncodedOrigin == origin);
msarett0e6274f2016-03-21 08:04:40 -070023
Hal Canaryc465d132017-12-08 10:21:31 -050024 codec = SkCodec::MakeFromStream(GetResourceAsStream("images/mandrill_512_q075.jpg"));
msarett0e6274f2016-03-21 08:04:40 -070025 REPORTER_ASSERT(r, nullptr != codec);
26 origin = codec->getOrigin();
Leon Scroggins IIIb6ab10f2017-10-18 14:42:43 -040027 REPORTER_ASSERT(r, kTopLeft_SkEncodedOrigin == origin);
msarett0e6274f2016-03-21 08:04:40 -070028}