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

Side by Side Diff: tests/Writer32Test.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/VkWrapTests.cpp ('k') | third_party/ktx/ktx.h » ('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 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 DEF_TEST(Writer32_data, reporter) { 281 DEF_TEST(Writer32_data, reporter) {
282 const char* str = "0123456789"; 282 const char* str = "0123456789";
283 SkAutoTUnref<SkData> data0(SkData::NewWithCString(str)); 283 SkAutoTUnref<SkData> data0(SkData::NewWithCString(str));
284 SkAutoTUnref<SkData> data1(SkData::NewEmpty()); 284 SkAutoTUnref<SkData> data1(SkData::NewEmpty());
285 285
286 const size_t sizes[] = { 286 const size_t sizes[] = {
287 SkWriter32::WriteDataSize(nullptr), 287 SkWriter32::WriteDataSize(nullptr),
288 SkWriter32::WriteDataSize(data0), 288 SkWriter32::WriteDataSize(data0),
289 SkWriter32::WriteDataSize(data1), 289 SkWriter32::WriteDataSize(data1),
290 }; 290 };
291 291
292 SkSWriter32<1000> writer; 292 SkSWriter32<1000> writer;
293 size_t sizeWritten = 0; 293 size_t sizeWritten = 0;
294 294
295 writer.writeData(nullptr); 295 writer.writeData(nullptr);
296 sizeWritten += sizes[0]; 296 sizeWritten += sizes[0];
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 auto 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 auto 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/VkWrapTests.cpp ('k') | third_party/ktx/ktx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698