OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |