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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 715093003: Clang incorrectly thinks this typedef is unused. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 SkRecordFillBounds(SkRect::MakeWH(50, 50), record, &bbh); 278 SkRecordFillBounds(SkRect::MakeWH(50, 50), record, &bbh);
279 REPORTER_ASSERT(r, bbh.fEntries.count() == 3); 279 REPORTER_ASSERT(r, bbh.fEntries.count() == 3);
280 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(1 0, 10, 40, 40))); 280 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(1 0, 10, 40, 40)));
281 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(2 0, 20, 30, 30))); 281 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(2 0, 20, 30, 30)));
282 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(1 0, 10, 40, 40))); 282 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(1 0, 10, 40, 40)));
283 } 283 }
284 284
285 DEF_TEST(RecordDraw_drawImage, r){ 285 DEF_TEST(RecordDraw_drawImage, r){
286 class SkCanvasMock : public SkCanvas { 286 class SkCanvasMock : public SkCanvas {
287 public: 287 public:
288 SkCanvasMock(int width, int height) : INHERITED(width, height) { 288 SkCanvasMock(int width, int height) : SkCanvas(width, height) {
tfarina 2014/11/12 11:12:02 thanks, this was the way I was "fixing" it locally
289 this->resetTestValues(); 289 this->resetTestValues();
290 } 290 }
291 virtual ~SkCanvasMock() {} 291 virtual ~SkCanvasMock() {}
292 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top , 292 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top ,
293 const SkPaint* paint = NULL) SK_OVERRIDE { 293 const SkPaint* paint = NULL) SK_OVERRIDE {
294 294
295 fDrawImageCalled = true; 295 fDrawImageCalled = true;
296 } 296 }
297 297
298 virtual void drawImageRect(const SkImage* image, const SkRect* src, 298 virtual void drawImageRect(const SkImage* image, const SkRect* src,
299 const SkRect& dst, 299 const SkRect& dst,
300 const SkPaint* paint = NULL) SK_OVERRIDE { 300 const SkPaint* paint = NULL) SK_OVERRIDE {
301 fDrawImageRectCalled = true; 301 fDrawImageRectCalled = true;
302 } 302 }
303 303
304 void resetTestValues() { 304 void resetTestValues() {
305 fDrawImageCalled = fDrawImageRectCalled = false; 305 fDrawImageCalled = fDrawImageRectCalled = false;
306 } 306 }
307 307
308 bool fDrawImageCalled; 308 bool fDrawImageCalled;
309 bool fDrawImageRectCalled; 309 bool fDrawImageRectCalled;
310 private:
311 typedef SkCanvas INHERITED;
312 }; 310 };
313 311
314 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(10, 10)); 312 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(10, 10));
315 surface->getCanvas()->clear(SK_ColorGREEN); 313 surface->getCanvas()->clear(SK_ColorGREEN);
316 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 314 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
317 315
318 SkCanvasMock canvas(10, 10); 316 SkCanvasMock canvas(10, 10);
319 317
320 { 318 {
321 SkRecord record; 319 SkRecord record;
322 SkRecorder recorder(&record, 10, 10); 320 SkRecorder recorder(&record, 10, 10);
323 recorder.drawImage(image, 0, 0); 321 recorder.drawImage(image, 0, 0);
324 SkRecordDraw(record, &canvas, 0, 0); 322 SkRecordDraw(record, &canvas, 0, 0);
325 } 323 }
326 REPORTER_ASSERT(r, canvas.fDrawImageCalled); 324 REPORTER_ASSERT(r, canvas.fDrawImageCalled);
327 canvas.resetTestValues(); 325 canvas.resetTestValues();
328 326
329 { 327 {
330 SkRecord record; 328 SkRecord record;
331 SkRecorder recorder(&record, 10, 10); 329 SkRecorder recorder(&record, 10, 10);
332 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); 330 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10));
333 SkRecordDraw(record, &canvas, 0, 0); 331 SkRecordDraw(record, &canvas, 0, 0);
334 } 332 }
335 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 333 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
336 334
337 } 335 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698