From 0038c12f337b7037ef698e2723099c7e3b19c4ca Mon Sep 17 00:00:00 2001 From: "mtklein@google.com" Date: Thu, 15 Aug 2013 21:01:32 +0000 Subject: Write NULL as "" so readString() always returns a non-NULL string. BUG= R=reed@google.com Review URL: https://codereview.chromium.org/22862002 git-svn-id: http://skia.googlecode.com/svn/trunk@10754 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/Writer32Test.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'tests/Writer32Test.cpp') diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp index 6ecfcf3eda..194164dd1c 100644 --- a/tests/Writer32Test.cpp +++ b/tests/Writer32Test.cpp @@ -24,29 +24,11 @@ static void check_contents(skiatest::Reporter* reporter, const SkWriter32& write static void test_string_null(skiatest::Reporter* reporter) { uint8_t storage[8]; SkWriter32 writer(0, storage, sizeof(storage)); - SkReader32 reader(storage, sizeof(storage)); - - const char* str; - size_t len; // Can we write NULL? writer.writeString(NULL); - const int32_t null[] = { 0xFFFF }; - check_contents(reporter, writer, null, sizeof(null)); - str = reader.readString(&len); - REPORTER_ASSERT(reporter, NULL == str); - REPORTER_ASSERT(reporter, 0 == len); - - writer.reset(storage, sizeof(storage)); - reader.rewind(); - - // Is NULL distinct from ""? - writer.writeString(""); - const int32_t empty[] = { 0x0, 0x0 }; - check_contents(reporter, writer, empty, sizeof(empty)); - str = reader.readString(&len); - REPORTER_ASSERT(reporter, 0 == strcmp("", str)); - REPORTER_ASSERT(reporter, 0 == len); + const int32_t expected[] = { 0x0, 0x0 }; + check_contents(reporter, writer, expected, sizeof(expected)); } static void test_rewind(skiatest::Reporter* reporter) { -- cgit v1.2.3