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

Side by Side Diff: tests/Writer32Test.cpp

Issue 1932223003: Remove SkWriter32::contiguousArray(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 7 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/core/SkRecordedDrawable.cpp ('k') | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkRandom.h" 8 #include "SkRandom.h"
9 #include "SkReader32.h" 9 #include "SkReader32.h"
10 #include "SkWriter32.h" 10 #include "SkWriter32.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 writer.reset(); 225 writer.reset();
226 test2(reporter, &writer); 226 test2(reporter, &writer);
227 227
228 writer.reset(); 228 writer.reset();
229 testWritePad(reporter, &writer); 229 testWritePad(reporter, &writer);
230 230
231 writer.reset(); 231 writer.reset();
232 testOverwriteT(reporter, &writer); 232 testOverwriteT(reporter, &writer);
233 } 233 }
234 234
235 DEF_TEST(Writer32_contiguous, reporter) {
236 uint32_t storage[256];
237 SkWriter32 writer;
238 writer.reset(storage, sizeof(storage));
239 // This write is small enough to fit in storage, so it's contiguous.
240 test1(reporter, &writer);
241 REPORTER_ASSERT(reporter, writer.contiguousArray() != nullptr);
242
243 // Everything other aspect of contiguous/non-contiguous is an
244 // implementation detail, not part of the public contract for
245 // SkWriter32, and so not tested here.
246 }
247
248 DEF_TEST(Writer32_small, reporter) { 235 DEF_TEST(Writer32_small, reporter) {
249 SkSWriter32<8 * sizeof(intptr_t)> writer; 236 SkSWriter32<8 * sizeof(intptr_t)> writer;
250 test1(reporter, &writer); 237 test1(reporter, &writer);
251 writer.reset(); // should just rewind our storage 238 writer.reset(); // should just rewind our storage
252 test2(reporter, &writer); 239 test2(reporter, &writer);
253 240
254 writer.reset(); 241 writer.reset();
255 testWritePad(reporter, &writer); 242 testWritePad(reporter, &writer);
256 243
257 writer.reset(); 244 writer.reset();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 d2(reader.readData()); 299 d2(reader.readData());
313 300
314 REPORTER_ASSERT(reporter, 0 == d0->size()); 301 REPORTER_ASSERT(reporter, 0 == d0->size());
315 REPORTER_ASSERT(reporter, strlen(str)+1 == d1->size()); 302 REPORTER_ASSERT(reporter, strlen(str)+1 == d1->size());
316 REPORTER_ASSERT(reporter, !memcmp(str, d1->data(), strlen(str)+1)); 303 REPORTER_ASSERT(reporter, !memcmp(str, d1->data(), strlen(str)+1));
317 REPORTER_ASSERT(reporter, 0 == d2->size()); 304 REPORTER_ASSERT(reporter, 0 == d2->size());
318 305
319 REPORTER_ASSERT(reporter, reader.offset() == sizeWritten); 306 REPORTER_ASSERT(reporter, reader.offset() == sizeWritten);
320 REPORTER_ASSERT(reporter, reader.eof()); 307 REPORTER_ASSERT(reporter, reader.eof());
321 } 308 }
OLDNEW
« no previous file with comments | « src/core/SkRecordedDrawable.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698