diff options
Diffstat (limited to 'tests/RecorderTest.cpp')
-rw-r--r-- | tests/RecorderTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp index 5fcac4d93e..1ca9206b47 100644 --- a/tests/RecorderTest.cpp +++ b/tests/RecorderTest.cpp @@ -7,6 +7,7 @@ #include "Test.h" +#include "SkPictureRecorder.h" #include "SkRecord.h" #include "SkRecorder.h" #include "SkRecords.h" @@ -67,3 +68,25 @@ DEF_TEST(Recorder_RefLeaking, r) { } REPORTER_ASSERT(r, paint.getShader()->unique()); } + +DEF_TEST(Recorder_RefPictures, r) { + SkAutoTUnref<SkPicture> pic; + + { + SkPictureRecorder pr; + SkCanvas* canvas = pr.beginRecording(100, 100); + canvas->drawColor(SK_ColorRED); + pic.reset(pr.endRecording()); + } + REPORTER_ASSERT(r, pic->unique()); + + { + SkRecord record; + SkRecorder recorder(&record, 100, 100); + recorder.drawPicture(pic); + // the recorder should now also be an owner + REPORTER_ASSERT(r, !pic->unique()); + } + // the recorder destructor should have released us (back to unique) + REPORTER_ASSERT(r, pic->unique()); +} |