msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 12 | DEF_TEST(ExifOrientation, r) { |
Ben Wagner | 145dbcd | 2016-11-03 14:40:50 -0400 | [diff] [blame] | 13 | std::unique_ptr<SkStream> stream(GetResourceAsStream("exif-orientation-2-ur.jpg")); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 14 | REPORTER_ASSERT(r, nullptr != stream); |
Brian Salomon | 92271fc | 2016-03-25 21:38:09 -0400 | [diff] [blame] | 15 | if (!stream) { |
| 16 | return; |
| 17 | } |
| 18 | |
Ben Wagner | 145dbcd | 2016-11-03 14:40:50 -0400 | [diff] [blame] | 19 | std::unique_ptr<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 20 | REPORTER_ASSERT(r, nullptr != codec); |
| 21 | SkCodec::Origin origin = codec->getOrigin(); |
| 22 | REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin); |
| 23 | |
bungeman | f93d711 | 2016-09-16 06:24:20 -0700 | [diff] [blame] | 24 | stream.reset(GetResourceAsStream("mandrill_512_q075.jpg")); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 25 | codec.reset(SkCodec::NewFromStream(stream.release())); |
| 26 | REPORTER_ASSERT(r, nullptr != codec); |
| 27 | origin = codec->getOrigin(); |
| 28 | REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin); |
| 29 | } |