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

Unified Diff: tests/Writer32Test.cpp

Issue 23646007: Fix bug in SkWriter32. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tweak 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkWriter32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Writer32Test.cpp
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 194164dd1c37959d81b6ecc91c28b4b9c19c91e3..fd232fc4d0f1f0a7878a8f1f9c2f2ae99159a7c0 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -21,6 +21,15 @@ static void check_contents(skiatest::Reporter* reporter, const SkWriter32& write
REPORTER_ASSERT(reporter, !memcmp(storage.get(), expected, size));
}
+
+static void test_reserve(skiatest::Reporter* reporter) {
+ // There used to be a bug where we'd assert your first reservation had to
+ // fit in external storage if you used it. This would crash in debug mode.
+ uint8_t storage[4];
+ SkWriter32 writer(0, storage, sizeof(storage));
+ writer.reserve(40);
+}
+
static void test_string_null(skiatest::Reporter* reporter) {
uint8_t storage[8];
SkWriter32 writer(0, storage, sizeof(storage));
@@ -238,6 +247,7 @@ static void Tests(skiatest::Reporter* reporter) {
testWritePad(reporter, &writer);
}
+ test_reserve(reporter);
test_string_null(reporter);
test_ptr(reporter);
test_rewind(reporter);
« no previous file with comments | « src/core/SkWriter32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698