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

Side by Side Diff: tests/ColorSpaceTest.cpp

Issue 2343933002: Revert of SkFontData to use smart pointers. (Closed)
Patch Set: Created 4 years, 3 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/CodecTest.cpp ('k') | tests/ExifTest.cpp » ('j') | 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 22 matching lines...) Expand all
33 const float* ref[3] = { red, green, blue }; 33 const float* ref[3] = { red, green, blue };
34 float dst[4]; 34 float dst[4];
35 for (int i = 0; i < 3; ++i) { 35 for (int i = 0; i < 3; ++i) {
36 mat.mapScalars(&src[i*4], dst); 36 mat.mapScalars(&src[i*4], dst);
37 REPORTER_ASSERT(r, almost_equal(ref[i][0], dst[0])); 37 REPORTER_ASSERT(r, almost_equal(ref[i][0], dst[0]));
38 REPORTER_ASSERT(r, almost_equal(ref[i][1], dst[1])); 38 REPORTER_ASSERT(r, almost_equal(ref[i][1], dst[1]));
39 REPORTER_ASSERT(r, almost_equal(ref[i][2], dst[2])); 39 REPORTER_ASSERT(r, almost_equal(ref[i][2], dst[2]));
40 } 40 }
41 } 41 }
42 42
43 static SkStreamAsset* resource(const char path[]) {
44 SkString fullPath = GetResourcePath(path);
45 return SkStream::NewFromFile(fullPath.c_str());
46 }
47
43 static void test_path(skiatest::Reporter* r, const char* path, 48 static void test_path(skiatest::Reporter* r, const char* path,
44 const float red[], const float green[], const float blue[] , 49 const float red[], const float green[], const float blue[] ,
45 const SkGammaNamed expectedGamma) { 50 const SkGammaNamed expectedGamma) {
46 SkAutoTDelete<SkStream> stream(GetResourceAsStream(path)); 51 SkAutoTDelete<SkStream> stream(resource(path));
47 REPORTER_ASSERT(r, nullptr != stream); 52 REPORTER_ASSERT(r, nullptr != stream);
48 if (!stream) { 53 if (!stream) {
49 return; 54 return;
50 } 55 }
51 56
52 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); 57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
53 REPORTER_ASSERT(r, nullptr != codec); 58 REPORTER_ASSERT(r, nullptr != codec);
54 if (!codec) { 59 if (!codec) {
55 return; 60 return;
56 } 61 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 REPORTER_ASSERT(r, !SkColorSpace::Equals(srgb.get(), nullptr)); 248 REPORTER_ASSERT(r, !SkColorSpace::Equals(srgb.get(), nullptr));
244 REPORTER_ASSERT(r, !SkColorSpace::Equals(adobe.get(), srgb.get())); 249 REPORTER_ASSERT(r, !SkColorSpace::Equals(adobe.get(), srgb.get()));
245 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), srgb.get())); 250 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), srgb.get()));
246 REPORTER_ASSERT(r, !SkColorSpace::Equals(z32.get(), z30.get())); 251 REPORTER_ASSERT(r, !SkColorSpace::Equals(z32.get(), z30.get()));
247 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), srgb.get())); 252 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), srgb.get()));
248 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), upperRight.get())) ; 253 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), upperRight.get())) ;
249 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), upperRight.get())); 254 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), upperRight.get()));
250 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get())); 255 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get()));
251 REPORTER_ASSERT(r, !SkColorSpace::Equals(rgb1.get(), rgb2.get())); 256 REPORTER_ASSERT(r, !SkColorSpace::Equals(rgb1.get(), rgb2.get()));
252 } 257 }
OLDNEW
« no previous file with comments | « tests/CodecTest.cpp ('k') | tests/ExifTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698