Chromium Code Reviews| Index: tests/RecorderTest.cpp |
| diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp |
| index 21a897ca8b1a5e3b10ec759f758cf7dae8381833..aced54f7a906fa32c56ffc5ee25ad8b10fd8fd1f 100644 |
| --- a/tests/RecorderTest.cpp |
| +++ b/tests/RecorderTest.cpp |
| @@ -68,6 +68,20 @@ DEF_TEST(Recorder_CommentGroups, r) { |
| REPORTER_ASSERT(r, 1 == tally.count<SkRecords::EndCommentGroup>()); |
| } |
| +// DrawData is similar to comment groups. It doesn't affect drawing, but |
| +// it's a pass-through we provide to the client. Again, a simple reg. test. |
| +DEF_TEST(Recorder_DrawData, r) { |
|
reed1
2014/09/04 20:53:04
for a future CL: perhaps this test could/should be
mtklein
2014/09/04 20:57:15
Acknowledged.
|
| + SkRecord record; |
| + SkRecorder recorder(&record, 100, 100); |
| + |
| + const char* data = "This sure is some data, eh?"; |
| + recorder.drawData(data, strlen(data)); |
| + |
| + Tally tally; |
| + tally.apply(record); |
| + REPORTER_ASSERT(r, 1 == tally.count<SkRecords::DrawData>()); |
| +} |
| + |
| // Regression test for leaking refs held by optional arguments. |
| DEF_TEST(Recorder_RefLeaking, r) { |
| // We use SaveLayer to test: |
| @@ -109,3 +123,30 @@ DEF_TEST(Recorder_RefPictures, r) { |
| // the recorder destructor should have released us (back to unique) |
| REPORTER_ASSERT(r, pic->unique()); |
| } |
| + |
| +DEF_TEST(Recorder_IsDrawingToLayer, r) { |
| + SkRecord record; |
| + SkRecorder recorder(&record, 100, 100); |
| + |
| + // We'll save, saveLayer, save, and saveLayer, then restore them all, |
| + // checking that isDrawingToLayer() is correct at each step. |
| + |
| + REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); |
| + recorder.save(); |
| + REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); |
| + recorder.saveLayer(NULL, NULL); |
| + REPORTER_ASSERT(r, recorder.isDrawingToLayer()); |
| + recorder.save(); |
| + REPORTER_ASSERT(r, recorder.isDrawingToLayer()); |
| + recorder.saveLayer(NULL, NULL); |
| + REPORTER_ASSERT(r, recorder.isDrawingToLayer()); |
| + recorder.restore(); |
| + REPORTER_ASSERT(r, recorder.isDrawingToLayer()); |
| + recorder.restore(); |
| + REPORTER_ASSERT(r, recorder.isDrawingToLayer()); |
| + recorder.restore(); |
| + REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); |
| + recorder.restore(); |
| + REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); |
| +} |
| + |