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

Side by Side Diff: tests/Writer32Test.cpp

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « tests/CodexTest.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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten()); 297 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
298 298
299 writer.writeData(data0); 299 writer.writeData(data0);
300 sizeWritten += sizes[1]; 300 sizeWritten += sizes[1];
301 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten()); 301 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
302 302
303 writer.writeData(data1); 303 writer.writeData(data1);
304 sizeWritten += sizes[2]; 304 sizeWritten += sizes[2];
305 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten()); 305 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
306 306
307 SkAutoTUnref<SkData> result(writer.snapshotAsData()); 307 auto result(writer.snapshotAsData());
308 308
309 SkReader32 reader(result->data(), result->size()); 309 SkReader32 reader(result->data(), result->size());
310 SkAutoTUnref<SkData> d0(reader.readData()), 310 auto d0(reader.readData()),
311 d1(reader.readData()), 311 d1(reader.readData()),
312 d2(reader.readData()); 312 d2(reader.readData());
313 313
314 REPORTER_ASSERT(reporter, 0 == d0->size()); 314 REPORTER_ASSERT(reporter, 0 == d0->size());
315 REPORTER_ASSERT(reporter, strlen(str)+1 == d1->size()); 315 REPORTER_ASSERT(reporter, strlen(str)+1 == d1->size());
316 REPORTER_ASSERT(reporter, !memcmp(str, d1->data(), strlen(str)+1)); 316 REPORTER_ASSERT(reporter, !memcmp(str, d1->data(), strlen(str)+1));
317 REPORTER_ASSERT(reporter, 0 == d2->size()); 317 REPORTER_ASSERT(reporter, 0 == d2->size());
318 318
319 REPORTER_ASSERT(reporter, reader.offset() == sizeWritten); 319 REPORTER_ASSERT(reporter, reader.offset() == sizeWritten);
320 REPORTER_ASSERT(reporter, reader.eof()); 320 REPORTER_ASSERT(reporter, reader.eof());
321 } 321 }
OLDNEW
« no previous file with comments | « tests/CodexTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698