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

Side by Side Diff: tests/TextBlobTest.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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/SurfaceTest.cpp ('k') | tests/TextureCompressionTest.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 2014 Google Inc. 2 * Copyright 2014 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 "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkPoint.h" 9 #include "SkPoint.h"
10 #include "SkTextBlob.h" 10 #include "SkTextBlob.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 unsigned glyphCount = 0; 168 unsigned glyphCount = 0;
169 unsigned posCount = 0; 169 unsigned posCount = 0;
170 170
171 for (unsigned i = 0; i < inCount; ++i) { 171 for (unsigned i = 0; i < inCount; ++i) {
172 AddRun(font, in[i].count, in[i].pos, SkPoint::Make(in[i].x, in[i].y) , builder); 172 AddRun(font, in[i].count, in[i].pos, SkPoint::Make(in[i].x, in[i].y) , builder);
173 glyphCount += in[i].count; 173 glyphCount += in[i].count;
174 posCount += in[i].count * in[i].pos; 174 posCount += in[i].count * in[i].pos;
175 } 175 }
176 176
177 SkAutoTUnref<const SkTextBlob> blob(builder.build()); 177 SkAutoTUnref<const SkTextBlob> blob(builder.build());
178 REPORTER_ASSERT(reporter, (NULL != blob->fGlyphBuffer) == (glyphCount > 0)); 178 REPORTER_ASSERT(reporter, SkToBool(blob->fGlyphBuffer) == (glyphCount > 0));
179 REPORTER_ASSERT(reporter, (NULL != blob->fPosBuffer) == (posCount > 0)); 179 REPORTER_ASSERT(reporter, SkToBool(blob->fPosBuffer) == (posCount > 0));
180 REPORTER_ASSERT(reporter, (NULL != blob->fRuns.get()) == (inCount > 0)); 180 REPORTER_ASSERT(reporter, SkToBool(blob->fRuns.get()) == (inCount > 0));
181 181
182 SkTextBlob::RunIterator it(blob); 182 SkTextBlob::RunIterator it(blob);
183 for (unsigned i = 0; i < outCount; ++i) { 183 for (unsigned i = 0; i < outCount; ++i) {
184 REPORTER_ASSERT(reporter, !it.done()); 184 REPORTER_ASSERT(reporter, !it.done());
185 REPORTER_ASSERT(reporter, out[i].pos == it.positioning()); 185 REPORTER_ASSERT(reporter, out[i].pos == it.positioning());
186 REPORTER_ASSERT(reporter, out[i].count == it.glyphCount()); 186 REPORTER_ASSERT(reporter, out[i].count == it.glyphCount());
187 if (SkTextBlob::kDefault_Positioning == out[i].pos) { 187 if (SkTextBlob::kDefault_Positioning == out[i].pos) {
188 REPORTER_ASSERT(reporter, out[i].x == it.offset().x()); 188 REPORTER_ASSERT(reporter, out[i].x == it.offset().x());
189 REPORTER_ASSERT(reporter, out[i].y == it.offset().y()); 189 REPORTER_ASSERT(reporter, out[i].y == it.offset().y());
190 } else if (SkTextBlob::kHorizontal_Positioning == out[i].pos) { 190 } else if (SkTextBlob::kHorizontal_Positioning == out[i].pos) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 default: 237 default:
238 SkFAIL("unhandled positioning value"); 238 SkFAIL("unhandled positioning value");
239 } 239 }
240 } 240 }
241 }; 241 };
242 242
243 DEF_TEST(TextBlob_builder, reporter) { 243 DEF_TEST(TextBlob_builder, reporter) {
244 TextBlobTester::TestBuilder(reporter); 244 TextBlobTester::TestBuilder(reporter);
245 TextBlobTester::TestBounds(reporter); 245 TextBlobTester::TestBounds(reporter);
246 } 246 }
OLDNEW
« no previous file with comments | « tests/SurfaceTest.cpp ('k') | tests/TextureCompressionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698