unify how we handle externally-provided storage in SkWriter32, with the goal
of simplifying the logic in reserve() so it can be inlined/accelerated.
Review URL: https://codereview.appspot.com/6962048
git-svn-id: http://skia.googlecode.com/svn/trunk@6923 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 4715f7a..bcdc559 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -173,7 +173,6 @@
// dynamic allocator
{
SkWriter32 writer(256 * 4);
- REPORTER_ASSERT(reporter, NULL == writer.getSingleBlock());
test1(reporter, &writer);
writer.reset();
@@ -183,13 +182,11 @@
testWritePad(reporter, &writer);
}
- // single-block
+ // storage-block
{
SkWriter32 writer(0);
uint32_t storage[256];
- REPORTER_ASSERT(reporter, NULL == writer.getSingleBlock());
writer.reset(storage, sizeof(storage));
- REPORTER_ASSERT(reporter, (void*)storage == writer.getSingleBlock());
test1(reporter, &writer);
writer.reset(storage, sizeof(storage));
@@ -197,6 +194,11 @@
writer.reset(storage, sizeof(storage));
testWritePad(reporter, &writer);
+
+ // try overflowing the storage-block
+ uint32_t smallStorage[8];
+ writer.reset(smallStorage, sizeof(smallStorage));
+ test2(reporter, &writer);
}
// small storage