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