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

Side by Side Diff: tests/CanvasTest.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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/CachedDecodingPixelRefTest.cpp ('k') | tests/DataRefTest.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 2012 Google Inc. 2 * Copyright 2012 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 /* Description: 8 /* Description:
9 * This test defines a series of elementatry test steps that perform 9 * This test defines a series of elementatry test steps that perform
10 * a single or a small group of canvas API calls. Each test step is 10 * a single or a small group of canvas API calls. Each test step is
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 const SkPMColor* addr = (const SkPMColor*)canvas->peekPixels(&info2, &rowByt es); 647 const SkPMColor* addr = (const SkPMColor*)canvas->peekPixels(&info2, &rowByt es);
648 REPORTER_ASSERT(reporter, addr); 648 REPORTER_ASSERT(reporter, addr);
649 REPORTER_ASSERT(reporter, info == info2); 649 REPORTER_ASSERT(reporter, info == info2);
650 REPORTER_ASSERT(reporter, minRowBytes == rowBytes); 650 REPORTER_ASSERT(reporter, minRowBytes == rowBytes);
651 for (int y = 0; y < info.height(); ++y) { 651 for (int y = 0; y < info.height(); ++y) {
652 for (int x = 0; x < info.width(); ++x) { 652 for (int x = 0; x < info.width(); ++x) {
653 REPORTER_ASSERT(reporter, 0 == addr[x]); 653 REPORTER_ASSERT(reporter, 0 == addr[x]);
654 } 654 }
655 addr = (const SkPMColor*)((const char*)addr + rowBytes); 655 addr = (const SkPMColor*)((const char*)addr + rowBytes);
656 } 656 }
657 SkDELETE(canvas); 657 delete canvas;
658 658
659 // now try a deliberately bad info 659 // now try a deliberately bad info
660 info = info.makeWH(-1, info.height()); 660 info = info.makeWH(-1, info.height());
661 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); 661 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
662 662
663 // too big 663 // too big
664 info = info.makeWH(1 << 30, 1 << 30); 664 info = info.makeWH(1 << 30, 1 << 30);
665 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); 665 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
666 666
667 // not a valid pixel type 667 // not a valid pixel type
668 info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType()); 668 info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType());
669 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); 669 REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
670 670
671 // We should succeed with a zero-sized valid info 671 // We should succeed with a zero-sized valid info
672 info = SkImageInfo::MakeN32Premul(0, 0); 672 info = SkImageInfo::MakeN32Premul(0, 0);
673 canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); 673 canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes);
674 REPORTER_ASSERT(reporter, canvas); 674 REPORTER_ASSERT(reporter, canvas);
675 SkDELETE(canvas); 675 delete canvas;
676 } 676 }
677 677
678 DEF_TEST(Canvas, reporter) { 678 DEF_TEST(Canvas, reporter) {
679 TestData d; 679 TestData d;
680 680
681 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { 681 for (int testStep = 0; testStep < testStepArray().count(); testStep++) {
682 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]); 682 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]);
683 if (testStepArray()[testStep]->enablePdfTesting()) { 683 if (testStepArray()[testStep]->enablePdfTesting()) {
684 TestPdfDevice(reporter, d, testStepArray()[testStep]); 684 TestPdfDevice(reporter, d, testStepArray()[testStep]);
685 } 685 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa trix()); 749 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa trix());
750 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl ipBounds(&clip2)); 750 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl ipBounds(&clip2));
751 REPORTER_ASSERT(reporter, clip1 == clip2); 751 REPORTER_ASSERT(reporter, clip1 == clip2);
752 752
753 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); 753 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100));
754 filterCanvas.scale(0.75f, 0.5f); 754 filterCanvas.scale(0.75f, 0.5f);
755 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa trix()); 755 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa trix());
756 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl ipBounds(&clip2)); 756 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl ipBounds(&clip2));
757 REPORTER_ASSERT(reporter, clip1 == clip2); 757 REPORTER_ASSERT(reporter, clip1 == clip2);
758 } 758 }
OLDNEW
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698