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

Side by Side Diff: tests/ColorSpaceTest.cpp

Issue 2257983003: Add checks for bogus profiles to SkColorSpace::NewICC() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Relax constraints Created 4 years, 2 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 | « src/core/SkColorSpace_ICC.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 "SkColorSpace.h" 10 #include "SkColorSpace.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 primaries.fWX = 0.3127f; 306 primaries.fWX = 0.3127f;
307 primaries.fWY = 0.3290f; 307 primaries.fWY = 0.3290f;
308 308
309 SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor); 309 SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
310 bool result = primaries.toXYZD50(&toXYZ); 310 bool result = primaries.toXYZD50(&toXYZ);
311 REPORTER_ASSERT(r, result); 311 REPORTER_ASSERT(r, result);
312 312
313 sk_sp<SkColorSpace> space = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderT argetGamma, toXYZ); 313 sk_sp<SkColorSpace> space = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderT argetGamma, toXYZ);
314 REPORTER_ASSERT(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) == spac e); 314 REPORTER_ASSERT(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) == spac e);
315 } 315 }
316
317 DEF_TEST(ColorSpace_Size, r) {
318 int memory[30];
319
320 // NewICC() should fail immediately because the size of the input profile is larger than
321 // the max size allowed.
322 REPORTER_ASSERT(r, !SkColorSpace::NewICC(memory, (2 << 22) + 1));
323 }
OLDNEW
« no previous file with comments | « src/core/SkColorSpace_ICC.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698