Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: tests/ExifTest.cpp

Issue 1840573004: Don't crash when resource path is omitted (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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[]) { 12 static SkStreamAsset* resource(const char path[]) {
13 SkString fullPath = GetResourcePath(path); 13 SkString fullPath = GetResourcePath(path);
14 return SkStream::NewFromFile(fullPath.c_str()); 14 return SkStream::NewFromFile(fullPath.c_str());
15 } 15 }
16 16
17 DEF_TEST(ExifOrientation, r) { 17 DEF_TEST(ExifOrientation, r) {
18 SkAutoTDelete<SkStream> stream(resource("exif-orientation-2-ur.jpg")); 18 SkAutoTDelete<SkStream> stream(resource("exif-orientation-2-ur.jpg"));
19 REPORTER_ASSERT(r, nullptr != stream); 19 REPORTER_ASSERT(r, nullptr != stream);
20 if (!stream) {
21 return;
22 }
23
20 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); 24 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
21 REPORTER_ASSERT(r, nullptr != codec); 25 REPORTER_ASSERT(r, nullptr != codec);
22 SkCodec::Origin origin = codec->getOrigin(); 26 SkCodec::Origin origin = codec->getOrigin();
23 REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin); 27 REPORTER_ASSERT(r, SkCodec::kTopRight_Origin == origin);
24 28
25 stream.reset(resource("mandrill_512_q075.jpg")); 29 stream.reset(resource("mandrill_512_q075.jpg"));
26 codec.reset(SkCodec::NewFromStream(stream.release())); 30 codec.reset(SkCodec::NewFromStream(stream.release()));
27 REPORTER_ASSERT(r, nullptr != codec); 31 REPORTER_ASSERT(r, nullptr != codec);
28 origin = codec->getOrigin(); 32 origin = codec->getOrigin();
29 REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin); 33 REPORTER_ASSERT(r, SkCodec::kTopLeft_Origin == origin);
30 } 34 }
OLDNEW
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698