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

Side by Side Diff: tests/TextBlobTest.cpp

Issue 588853002: Revert of Souped-up SkTextBlob. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/core/SkTextBlob.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 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, SkToBool(blob->fGlyphBuffer) == (glyphCount > 0));
179 REPORTER_ASSERT(reporter, SkToBool(blob->fPosBuffer) == (posCount > 0));
180 REPORTER_ASSERT(reporter, SkToBool(blob->fRuns.get()) == (inCount > 0));
178 181
179 SkTextBlob::RunIterator it(blob); 182 SkTextBlob::RunIterator it(blob);
180 for (unsigned i = 0; i < outCount; ++i) { 183 for (unsigned i = 0; i < outCount; ++i) {
181 REPORTER_ASSERT(reporter, !it.done()); 184 REPORTER_ASSERT(reporter, !it.done());
182 REPORTER_ASSERT(reporter, out[i].pos == it.positioning()); 185 REPORTER_ASSERT(reporter, out[i].pos == it.positioning());
183 REPORTER_ASSERT(reporter, out[i].count == it.glyphCount()); 186 REPORTER_ASSERT(reporter, out[i].count == it.glyphCount());
184 if (SkTextBlob::kDefault_Positioning == out[i].pos) { 187 if (SkTextBlob::kDefault_Positioning == out[i].pos) {
185 REPORTER_ASSERT(reporter, out[i].x == it.offset().x()); 188 REPORTER_ASSERT(reporter, out[i].x == it.offset().x());
186 REPORTER_ASSERT(reporter, out[i].y == it.offset().y()); 189 REPORTER_ASSERT(reporter, out[i].y == it.offset().y());
187 } 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
234 default: 237 default:
235 SkFAIL("unhandled positioning value"); 238 SkFAIL("unhandled positioning value");
236 } 239 }
237 } 240 }
238 }; 241 };
239 242
240 DEF_TEST(TextBlob_builder, reporter) { 243 DEF_TEST(TextBlob_builder, reporter) {
241 TextBlobTester::TestBuilder(reporter); 244 TextBlobTester::TestBuilder(reporter);
242 TextBlobTester::TestBounds(reporter); 245 TextBlobTester::TestBounds(reporter);
243 } 246 }
OLDNEW
« no previous file with comments | « src/core/SkTextBlob.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698