OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |