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

Unified Diff: tests/CanvasTest.cpp

Issue 763503003: add basic tests for save/restore counting (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | 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 5437d5b2da96a0463041574b8772c664468a275c..d5ddfe6fb05221c3b94848ccbe759ffef808a6b0 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -795,3 +795,21 @@ DEF_TEST(Canvas, reporter) {
test_newraster(reporter);
}
+
+DEF_TEST(Canvas_SaveState, reporter) {
+ SkCanvas canvas(10, 10);
+ REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount());
+
+ int n = canvas.save();
+ REPORTER_ASSERT(reporter, 1 == n);
+ REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount());
+
+ n = canvas.saveLayer(NULL, NULL);
+ REPORTER_ASSERT(reporter, 2 == n);
+ REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount());
+
+ canvas.restore();
+ REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount());
+ canvas.restore();
+ REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount());
+}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698