aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Writer32Test.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-21 15:36:33 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-21 15:36:33 +0000
commit5595af1b2ebe6590e98641464d43d22281a7f295 (patch)
tree0534fea47765d36fea593666cda4633241a61e65 /tests/Writer32Test.cpp
parent2859eb74f9c87471b2429cd12b84144b97157efb (diff)
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
Diffstat (limited to 'tests/Writer32Test.cpp')
-rw-r--r--tests/Writer32Test.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 4715f7a613..bcdc559407 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -173,7 +173,6 @@ static void Tests(skiatest::Reporter* reporter) {
// dynamic allocator
{
SkWriter32 writer(256 * 4);
- REPORTER_ASSERT(reporter, NULL == writer.getSingleBlock());
test1(reporter, &writer);
writer.reset();
@@ -183,13 +182,11 @@ static void Tests(skiatest::Reporter* reporter) {
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 @@ static void Tests(skiatest::Reporter* reporter) {
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