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

Side by Side Diff: tests/RecorderTest.cpp

Issue 830083002: remove unused drawData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | tests/SerializationTest.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 2014 Google Inc. 2 * Copyright 2014 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 7
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 recorder.endCommentGroup(); 62 recorder.endCommentGroup();
63 63
64 Tally tally; 64 Tally tally;
65 tally.apply(record); 65 tally.apply(record);
66 66
67 REPORTER_ASSERT(r, 1 == tally.count<SkRecords::BeginCommentGroup>()); 67 REPORTER_ASSERT(r, 1 == tally.count<SkRecords::BeginCommentGroup>());
68 REPORTER_ASSERT(r, 2 == tally.count<SkRecords::AddComment>()); 68 REPORTER_ASSERT(r, 2 == tally.count<SkRecords::AddComment>());
69 REPORTER_ASSERT(r, 1 == tally.count<SkRecords::EndCommentGroup>()); 69 REPORTER_ASSERT(r, 1 == tally.count<SkRecords::EndCommentGroup>());
70 } 70 }
71 71
72 // DrawData is similar to comment groups. It doesn't affect drawing, but
73 // it's a pass-through we provide to the client. Again, a simple reg. test.
74 DEF_TEST(Recorder_DrawData, r) {
75 SkRecord record;
76 SkRecorder recorder(&record, 100, 100);
77
78 const char* data = "This sure is some data, eh?";
79 recorder.drawData(data, strlen(data));
80
81 Tally tally;
82 tally.apply(record);
83 REPORTER_ASSERT(r, 1 == tally.count<SkRecords::DrawData>());
84 }
85
86 // Regression test for leaking refs held by optional arguments. 72 // Regression test for leaking refs held by optional arguments.
87 DEF_TEST(Recorder_RefLeaking, r) { 73 DEF_TEST(Recorder_RefLeaking, r) {
88 // We use SaveLayer to test: 74 // We use SaveLayer to test:
89 // - its SkRect argument is optional and SkRect is POD. Just testing that that works. 75 // - its SkRect argument is optional and SkRect is POD. Just testing that that works.
90 // - its SkPaint argument is optional and SkPaint is not POD. The bug was here. 76 // - its SkPaint argument is optional and SkPaint is not POD. The bug was here.
91 77
92 SkRect bounds = SkRect::MakeWH(320, 240); 78 SkRect bounds = SkRect::MakeWH(320, 240);
93 SkPaint paint; 79 SkPaint paint;
94 paint.setShader(SkShader::CreateEmptyShader())->unref(); 80 paint.setShader(SkShader::CreateEmptyShader())->unref();
95 81
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 recorder.drawImageRect(image.get(), 0, SkRect::MakeWH(100, 100)); 142 recorder.drawImageRect(image.get(), 0, SkRect::MakeWH(100, 100));
157 REPORTER_ASSERT(reporter, !image->unique()); 143 REPORTER_ASSERT(reporter, !image->unique());
158 144
159 Tally tally; 145 Tally tally;
160 tally.apply(record); 146 tally.apply(record);
161 147
162 REPORTER_ASSERT(reporter, 1 == tally.count<SkRecords::DrawImageRect>()); 148 REPORTER_ASSERT(reporter, 1 == tally.count<SkRecords::DrawImageRect>());
163 } 149 }
164 REPORTER_ASSERT(reporter, image->unique()); 150 REPORTER_ASSERT(reporter, image->unique());
165 } 151 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698