| Index: tests/PictureTest.cpp
|
| diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
|
| index 5bc60371c997f957f56a0f122602812822c813fb..f2e6c553a6274187eedd7ee27adc8f5a36c5ce1d 100644
|
| --- a/tests/PictureTest.cpp
|
| +++ b/tests/PictureTest.cpp
|
| @@ -1721,6 +1721,20 @@ static void test_gen_id(skiatest::Reporter* reporter) {
|
| REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID());
|
| }
|
|
|
| +static void test_bytes_used(skiatest::Reporter* reporter) {
|
| + SkPictureRecorder recorder;
|
| +
|
| + recorder.beginRecording(0, 0);
|
| + SkAutoTUnref<SkPicture> empty(recorder.endRecording());
|
| +
|
| + // A SkPicture also has SkRecord and possibly SkBBHierarchy as members.
|
| + REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get()) >=
|
| + sizeof(SkPicture));
|
| +
|
| + // Protect against any unintentional bloat.
|
| + REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get()) <= 176);
|
| +}
|
| +
|
| DEF_TEST(Picture, reporter) {
|
| #ifdef SK_DEBUG
|
| test_deleting_empty_picture();
|
| @@ -1743,6 +1757,7 @@ DEF_TEST(Picture, reporter) {
|
| test_hierarchical(reporter);
|
| test_gen_id(reporter);
|
| test_savelayer_extraction(reporter);
|
| + test_bytes_used(reporter);
|
| }
|
|
|
| static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
|
| @@ -1837,6 +1852,7 @@ struct CountingBBH : public SkBBoxHierarchy {
|
| }
|
|
|
| virtual void insert(SkAutoTMalloc<SkRect>*, int) SK_OVERRIDE {}
|
| + virtual size_t bytesUsed() const { return 0; }
|
| };
|
|
|
| class SpoonFedBBHFactory : public SkBBHFactory {
|
|
|