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

Side by Side Diff: tests/PictureTest.cpp

Issue 17113004: Replace SkPicture(SkStream) constructors with a factory. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a change in behavior Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | tools/bench_pictures_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Test.h" 7 #include "Test.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 SkAutoDataUnref picture1(serialized_picture_from_bitmap(original)); 413 SkAutoDataUnref picture1(serialized_picture_from_bitmap(original));
414 SkAutoDataUnref picture2(serialized_picture_from_bitmap(bm)); 414 SkAutoDataUnref picture2(serialized_picture_from_bitmap(bm));
415 REPORTER_ASSERT(reporter, picture1->equals(picture2)); 415 REPORTER_ASSERT(reporter, picture1->equals(picture2));
416 // Now test that a parse error was generated when trying to create a new SkP icture without 416 // Now test that a parse error was generated when trying to create a new SkP icture without
417 // providing a function to decode the bitmap. 417 // providing a function to decode the bitmap.
418 ErrorContext context; 418 ErrorContext context;
419 context.fErrors = 0; 419 context.fErrors = 0;
420 context.fReporter = reporter; 420 context.fReporter = reporter;
421 SkSetErrorCallback(assert_one_parse_error_cb, &context); 421 SkSetErrorCallback(assert_one_parse_error_cb, &context);
422 SkMemoryStream pictureStream(picture1); 422 SkMemoryStream pictureStream(picture1);
423 bool success;
424 SkClearLastError(); 423 SkClearLastError();
425 SkPicture pictureFromStream(&pictureStream, &success, NULL); 424 SkAutoUnref pictureFromStream(SkPicture::CreateFromStream(&pictureStream, NU LL));
426 REPORTER_ASSERT(reporter, success); 425 REPORTER_ASSERT(reporter, pictureFromStream.get() != NULL);
427 SkClearLastError(); 426 SkClearLastError();
428 SkSetErrorCallback(NULL, NULL); 427 SkSetErrorCallback(NULL, NULL);
429 } 428 }
430 429
431 static void test_clone_empty(skiatest::Reporter* reporter) { 430 static void test_clone_empty(skiatest::Reporter* reporter) {
432 // This is a regression test for crbug.com/172062 431 // This is a regression test for crbug.com/172062
433 // Before the fix, we used to crash accessing a null pointer when we 432 // Before the fix, we used to crash accessing a null pointer when we
434 // had a picture with no paints. This test passes by not crashing. 433 // had a picture with no paints. This test passes by not crashing.
435 { 434 {
436 SkPicture picture; 435 SkPicture picture;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 #endif 557 #endif
559 test_peephole(); 558 test_peephole();
560 test_gatherpixelrefs(reporter); 559 test_gatherpixelrefs(reporter);
561 test_bitmap_with_encoded_data(reporter); 560 test_bitmap_with_encoded_data(reporter);
562 test_clone_empty(reporter); 561 test_clone_empty(reporter);
563 test_clip_bound_opt(reporter); 562 test_clip_bound_opt(reporter);
564 } 563 }
565 564
566 #include "TestClassDef.h" 565 #include "TestClassDef.h"
567 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture) 566 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture)
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | tools/bench_pictures_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698