testStep->assertMessage());
}
TEST_STEP(DrawLayer, DrawLayerTestStep);
+\r
+static void NestedSaveRestoreWithSolidPaintTestStep(SkCanvas* canvas,\r
+ skiatest::Reporter* reporter,\r
+ CanvasTestStep* testStep) {\r
+ // This test step challenges the TestDeferredCanvasStateConsistency\r
+ // test cases because the opaque paint can trigger an optimization\r
+ // that discards previously recorded commands. The challenge is to maintain\r
+ // correct clip and matrix stack state.\r
+ canvas->resetMatrix();\r
+ canvas->rotate(SkIntToScalar(30));\r
+ canvas->save();\r
+ canvas->translate(SkIntToScalar(2), SkIntToScalar(1));\r
+ canvas->save();\r
+ canvas->scale(SkIntToScalar(3), SkIntToScalar(3));\r
+ SkPaint paint;\r
+ paint.setColor(0xFFFFFFFF);\r
+ canvas->drawPaint(paint);\r
+ canvas->restore();\r
+ canvas->restore();\r
+}\r
+TEST_STEP(NestedSaveRestoreWithSolidPaint, \\r
+ NestedSaveRestoreWithSolidPaintTestStep);\r
+\r
+static void NestedSaveRestoreWithFlushTestStep(SkCanvas* canvas,\r
+ skiatest::Reporter* reporter,\r
+ CanvasTestStep* testStep) {\r
+ // This test step challenges the TestDeferredCanvasStateConsistency\r
+ // test case because the canvas flush on a deferred canvas will\r
+ // reset the recording session. The challenge is to maintain correct\r
+ // clip and matrix stack state on the playback canvas.\r
+ canvas->resetMatrix();\r
+ canvas->rotate(SkIntToScalar(30));\r
+ canvas->save();\r
+ canvas->translate(SkIntToScalar(2), SkIntToScalar(1));\r
+ canvas->save();\r
+ canvas->scale(SkIntToScalar(3), SkIntToScalar(3));\r
+ canvas->drawRect(kTestRect,kTestPaint);\r
+ canvas->flush();\r
+ canvas->restore();\r
+ canvas->restore();\r
+}\r
+TEST_STEP(NestedSaveRestoreWithFlush, \\r
+ NestedSaveRestoreWithFlushTestStep);\r
static void AssertCanvasStatesEqual(skiatest::Reporter* reporter,
const SkCanvas* canvas1,