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

Side by Side 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 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/SkCanvas.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 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 788
789 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { 789 for (int testStep = 0; testStep < testStepArray().count(); testStep++) {
790 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]); 790 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]);
791 if (testStepArray()[testStep]->enablePdfTesting()) { 791 if (testStepArray()[testStep]->enablePdfTesting()) {
792 TestPdfDevice(reporter, d, testStepArray()[testStep]); 792 TestPdfDevice(reporter, d, testStepArray()[testStep]);
793 } 793 }
794 } 794 }
795 795
796 test_newraster(reporter); 796 test_newraster(reporter);
797 } 797 }
798
799 DEF_TEST(Canvas_SaveState, reporter) {
800 SkCanvas canvas(10, 10);
801 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount());
802
803 int n = canvas.save();
804 REPORTER_ASSERT(reporter, 1 == n);
805 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount());
806
807 n = canvas.saveLayer(NULL, NULL);
808 REPORTER_ASSERT(reporter, 2 == n);
809 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount());
810
811 canvas.restore();
812 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount());
813 canvas.restore();
814 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount());
815 }
OLDNEW
« 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