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) { |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 13 | std::unique_ptr<SkStream> stream(GetResourceAsStream("images/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 | |
Mike Reed | ede7bac | 2017-07-23 15:30:02 -0400 | [diff] [blame] | 19 | std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream))); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 20 | REPORTER_ASSERT(r, nullptr != codec); |
Leon Scroggins III | b6ab10f | 2017-10-18 14:42:43 -0400 | [diff] [blame] | 21 | SkEncodedOrigin origin = codec->getOrigin(); |
| 22 | REPORTER_ASSERT(r, kTopRight_SkEncodedOrigin == origin); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 23 | |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 24 | codec = SkCodec::MakeFromStream(GetResourceAsStream("images/mandrill_512_q075.jpg")); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 25 | REPORTER_ASSERT(r, nullptr != codec); |
| 26 | origin = codec->getOrigin(); |
Leon Scroggins III | b6ab10f | 2017-10-18 14:42:43 -0400 | [diff] [blame] | 27 | REPORTER_ASSERT(r, kTopLeft_SkEncodedOrigin == origin); |
msarett | 0e6274f | 2016-03-21 08:04:40 -0700 | [diff] [blame] | 28 | } |