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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 665103002: Dilate approximated text bounds to squelch recent assertion failure. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update unit test Created 6 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/SkRecordDraw.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 "Test.h" 8 #include "Test.h"
9 #include "RecordTestUtils.h" 9 #include "RecordTestUtils.h"
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 const SkPoint pos[] = { {40, 50}, {60, 70} }; 159 const SkPoint pos[] = { {40, 50}, {60, 70} };
160 recorder.drawPosText(text, bytes, pos, SkPaint()); 160 recorder.drawPosText(text, bytes, pos, SkPaint());
161 161
162 TestBBH bbh; 162 TestBBH bbh;
163 SkRecordFillBounds(record, &bbh); 163 SkRecordFillBounds(record, &bbh);
164 REPORTER_ASSERT(r, bbh.fEntries.count() == 2); 164 REPORTER_ASSERT(r, bbh.fEntries.count() == 2);
165 165
166 // We can make these next assertions confidently because SkRecordFillBounds 166 // We can make these next assertions confidently because SkRecordFillBounds
167 // builds its bounds by overestimating font metrics in a platform-independen t way. 167 // builds its bounds by overestimating font metrics in a platform-independen t way.
168 // If that changes, these tests will need to be more flexible. 168 // If that changes, these tests will need to be more flexible.
169 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(- 86, 6, 116, 54))); 169 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(- 110, 0, 140, 60)));
170 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(- 56, 26, 156, 94))); 170 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(- 80, 20, 180, 100)));
171 } 171 }
172 172
173 // Base test to ensure start/stop range is respected 173 // Base test to ensure start/stop range is respected
174 DEF_TEST(RecordDraw_PartialStartStop, r) { 174 DEF_TEST(RecordDraw_PartialStartStop, r) {
175 static const int kWidth = 10, kHeight = 10; 175 static const int kWidth = 10, kHeight = 10;
176 176
177 SkRect r1 = { 0, 0, kWidth, kHeight }; 177 SkRect r1 = { 0, 0, kWidth, kHeight };
178 SkRect r2 = { 0, 0, kWidth, kHeight/2 }; 178 SkRect r2 = { 0, 0, kWidth, kHeight/2 };
179 SkRect r3 = { 0, 0, kWidth/2, kHeight }; 179 SkRect r3 = { 0, 0, kWidth/2, kHeight };
180 SkPaint p; 180 SkPaint p;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 { 302 {
303 SkRecord record; 303 SkRecord record;
304 SkRecorder recorder(&record, 10, 10); 304 SkRecorder recorder(&record, 10, 10);
305 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); 305 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10));
306 SkRecordDraw(record, &canvas, 0, 0); 306 SkRecordDraw(record, &canvas, 0, 0);
307 } 307 }
308 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 308 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
309 309
310 } 310 }
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698