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

Unified Diff: tests/CanvasTest.cpp

Issue 614773004: Add tests for SkCanvas::drawImage[Rect]() Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change dest rect in DrawImageRect test step 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CanvasTest.cpp
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 3cefcbd4de8cdbc98e5ec09707a0c8a29ad58f61..ac7bf2a64fd070fb3b73d5d43c9ca0018bf78f6a 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -117,6 +117,7 @@ public:
, fText("Hello World")
, fPoints2(kTestPoints2)
, fBitmap(TestBitmap())
+ , fImage(createImage(fColor))
{ }
SkRect fRect;
@@ -134,8 +135,14 @@ public:
SkString fText;
const SkPoint* fPoints2;
SkBitmap fBitmap;
+ SkAutoTUnref<const SkImage> fImage;
private:
+ static const SkImage* createImage(SkColor color) {
+ SkAutoTUnref<SkSurface> surface (createSurface(color));
+
+ return surface->newImageSnapshot();
+ }
static SkMatrix TestMatrix() {
SkMatrix matrix;
matrix.reset();
@@ -373,6 +380,9 @@ SIMPLE_TEST_STEP(DrawData, drawData(d.fText.c_str(), d.fText.size()));
SIMPLE_TEST_STEP(BeginGroup, beginCommentGroup(d.fText.c_str()));
SIMPLE_TEST_STEP(AddComment, addComment(d.fText.c_str(), d.fText.c_str()));
SIMPLE_TEST_STEP(EndGroup, endCommentGroup());
+SIMPLE_TEST_STEP(DrawImage, drawImage(d.fImage, 0, 0));
+SIMPLE_TEST_STEP(DrawImageRect, drawImageRect(d.fImage, 0, d.fRect));
+
///////////////////////////////////////////////////////////////////////////////
// Complex test steps
« 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