Improving CanvasTest to verify that the destination canvas of an SkDeferredCanvas has the same state as a plain SkCanvas that received the same draw commands.
This new test code shows that the SkGPipe port of SkDeferredCanvas solves problems we were having with SkPicture.
Review URL: https://codereview.appspot.com/6425048

git-svn-id: http://skia.googlecode.com/svn/trunk@4665 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 11f6eab..38ccc90 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -123,6 +123,8 @@
     "test step %s, SkPicture state consistency in playback canvas";
 static const char* const kDeferredPreFlushAssertMessageFormat = 
     "test step %s, SkDeferredCanvas state consistency before flush";
+static const char* const kDeferredPostFlushPlaybackAssertMessageFormat =
+    "test step %s, SkDeferredCanvas playback canvas state consistency after flush";
 static const char* const kDeferredPostFlushAssertMessageFormat = 
     "test step %s, SkDeferredCanvas state consistency after flush";
 static const char* const kPictureResourceReuseMessageFormat =
@@ -711,13 +713,21 @@
     AssertCanvasStatesEqual(reporter, &deferredCanvas, &referenceCanvas,
         testStep);
 
+#if SK_DEFERRED_CANVAS_USES_GPIPE
+    deferredCanvas.flush();
+    testStep->setAssertMessageFormat(
+        kDeferredPostFlushPlaybackAssertMessageFormat);
+    AssertCanvasStatesEqual(reporter, 
+        deferredCanvas.getDeferredDevice()->immediateCanvas(),
+        &referenceCanvas, testStep);
+#endif
+
     // Verified that deferred canvas state is not affected by flushing
     // pending draw operations
 
     // The following test code is commented out because it currently fails.
     // Issue: http://code.google.com/p/skia/issues/detail?id=496
     /*
-    deferredCanvas.flush();
     testStep->setAssertMessageFormat(kDeferredPostFlushAssertMessageFormat);
     AssertCanvasStatesEqual(reporter, &deferredCanvas, &referenceCanvas,
         testStep);