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

Side by Side Diff: tests/Writer32Test.cpp

Issue 19564007: Start from scratch on a faster SkFlatDictionary. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix windows build by making AllocScratch static Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 writer.reset(); 181 writer.reset();
182 testWritePad(reporter, &writer); 182 testWritePad(reporter, &writer);
183 } 183 }
184 184
185 // storage-block 185 // storage-block
186 { 186 {
187 SkWriter32 writer(0); 187 SkWriter32 writer(0);
188 uint32_t storage[256]; 188 uint32_t storage[256];
189 writer.reset(storage, sizeof(storage)); 189 writer.reset(storage, sizeof(storage));
190 // These three writes are small enough to fit in storage.
190 test1(reporter, &writer); 191 test1(reporter, &writer);
192 REPORTER_ASSERT(reporter, writer.wroteOnlyToStorage());
191 193
192 writer.reset(storage, sizeof(storage)); 194 writer.reset(storage, sizeof(storage));
193 test2(reporter, &writer); 195 test2(reporter, &writer);
196 REPORTER_ASSERT(reporter, writer.wroteOnlyToStorage());
194 197
195 writer.reset(storage, sizeof(storage)); 198 writer.reset(storage, sizeof(storage));
196 testWritePad(reporter, &writer); 199 testWritePad(reporter, &writer);
200 REPORTER_ASSERT(reporter, writer.wroteOnlyToStorage());
197 201
198 // try overflowing the storage-block 202 // Try overflowing the storage-block.
199 uint32_t smallStorage[8]; 203 uint32_t smallStorage[8];
200 writer.reset(smallStorage, sizeof(smallStorage)); 204 writer.reset(smallStorage, sizeof(smallStorage));
201 test2(reporter, &writer); 205 test2(reporter, &writer);
206 REPORTER_ASSERT(reporter, !writer.wroteOnlyToStorage());
202 } 207 }
203 208
204 // small storage 209 // small storage
205 { 210 {
206 SkSWriter32<8 * sizeof(intptr_t)> writer(100); 211 SkSWriter32<8 * sizeof(intptr_t)> writer(100);
207 test1(reporter, &writer); 212 test1(reporter, &writer);
208 writer.reset(); // should just rewind our storage 213 writer.reset(); // should just rewind our storage
209 test2(reporter, &writer); 214 test2(reporter, &writer);
210 215
211 writer.reset(); 216 writer.reset();
(...skipping 10 matching lines...) Expand all
222 writer.reset(); 227 writer.reset();
223 testWritePad(reporter, &writer); 228 testWritePad(reporter, &writer);
224 } 229 }
225 230
226 test_ptr(reporter); 231 test_ptr(reporter);
227 test_rewind(reporter); 232 test_rewind(reporter);
228 } 233 }
229 234
230 #include "TestClassDef.h" 235 #include "TestClassDef.h"
231 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) 236 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698