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

Unified Diff: tests/PictureTest.cpp

Issue 1319723002: Have SkPicture::willPlayBackBitmaps() count SkImages too. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/core/SkPictureCommon.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 2afb0dd73d1ebe5762a76ed4f40986e355768730..ce14213e820aed0067fd33bb00a6ef6d73b75070 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -48,6 +48,21 @@ static void make_bm(SkBitmap* bm, int w, int h, SkColor color, bool immutable) {
}
}
+// For a while willPlayBackBitmaps() ignored SkImages and just looked for SkBitmaps.
+static void test_images_are_found_by_willPlayBackBitmaps(skiatest::Reporter* reporter) {
+ // We just need _some_ SkImage.
+ SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(SkBitmap()));
f(malita) 2015/08/26 14:56:00 I was kinda surprised that this works: we never in
mtklein 2015/08/26 15:13:56 Yeah, I was just sort of looking for the simplest
+
+ SkPictureRecorder recorder;
+ {
+ auto canvas = recorder.beginRecording(100,100);
+ canvas->drawImage(image, 0,0);
+ }
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+
+ REPORTER_ASSERT(reporter, picture->willPlayBackBitmaps());
+}
+
/* Hit a few SkPicture::Analysis cases not handled elsewhere. */
static void test_analysis(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
@@ -1149,6 +1164,7 @@ DEF_TEST(Picture, reporter) {
test_gpu_veto(reporter);
#endif
test_has_text(reporter);
+ test_images_are_found_by_willPlayBackBitmaps(reporter);
test_analysis(reporter);
test_bitmap_with_encoded_data(reporter);
test_clip_bound_opt(reporter);
« no previous file with comments | « src/core/SkPictureCommon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698