Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: tests/PictureTest.cpp

Issue 490253003: Implement SkPicture::bytesUsed() for SkRecord backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to SkPictureUtils, start unit test Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index c87d9c75ca4048d8dac024028bb03c58845285f7..7fa6b9684ffee49ea0b56999eddee8250715eb24 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1698,6 +1698,17 @@ 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));
+}
+
DEF_TEST(Picture, reporter) {
#ifdef SK_DEBUG
test_deleting_empty_picture();
@@ -1723,6 +1734,7 @@ DEF_TEST(Picture, reporter) {
test_clip_expansion(reporter);
test_hierarchical(reporter);
test_gen_id(reporter);
+ test_bytes_used(reporter);
}
#if SK_SUPPORT_GPU
@@ -1829,6 +1841,7 @@ struct CountingBBH : public SkBBoxHierarchy {
virtual int getCount() const { return 0; }
virtual int getDepth() const { return 0; }
virtual void rewindInserts() {}
+ virtual size_t bytesUsed() const { return 0; }
};
class SpoonFedBBHFactory : public SkBBHFactory {

Powered by Google App Engine
This is Rietveld 408576698