From 4979f32cd3fd29db5f23712f0aea3cf01a5c695d Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 14 Oct 2013 16:49:15 +0000 Subject: remove SkDataSet, and just store a key/value in SkAnnotation BUG= R=mtklein@google.com Review URL: https://codereview.chromium.org/27208002 git-svn-id: http://skia.googlecode.com/svn/trunk@11759 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/DataRefTest.cpp | 67 --------------------------------------------------- 1 file changed, 67 deletions(-) (limited to 'tests') diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index 313a61066d..9043a58722 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -7,7 +7,6 @@ */ #include "Test.h" #include "SkData.h" -#include "SkDataSet.h" #include "SkDataTable.h" #include "SkOrderedReadBuffer.h" #include "SkOrderedWriteBuffer.h" @@ -162,71 +161,6 @@ static void TestDataTable(skiatest::Reporter* reporter) { test_globaltable(reporter); } -static void unrefAll(const SkDataSet::Pair pairs[], int count) { - for (int i = 0; i < count; ++i) { - pairs[i].fValue->unref(); - } -} - -// asserts that inner is a subset of outer -static void test_dataset_subset(skiatest::Reporter* reporter, - const SkDataSet& outer, const SkDataSet& inner) { - SkDataSet::Iter iter(inner); - for (; !iter.done(); iter.next()) { - SkData* outerData = outer.find(iter.key()); - REPORTER_ASSERT(reporter, outerData); - REPORTER_ASSERT(reporter, outerData->equals(iter.value())); - } -} - -static void test_datasets_equal(skiatest::Reporter* reporter, - const SkDataSet& ds0, const SkDataSet& ds1) { - REPORTER_ASSERT(reporter, ds0.count() == ds1.count()); - - test_dataset_subset(reporter, ds0, ds1); - test_dataset_subset(reporter, ds1, ds0); -} - -static void test_dataset(skiatest::Reporter* reporter, const SkDataSet& ds, - int count) { - REPORTER_ASSERT(reporter, ds.count() == count); - - SkDataSet::Iter iter(ds); - int index = 0; - for (; !iter.done(); iter.next()) { -// const char* name = iter.key(); -// SkData* data = iter.value(); -// SkDebugf("[%d] %s:%s\n", index, name, (const char*)data->bytes()); - index += 1; - } - REPORTER_ASSERT(reporter, index == count); - - SkDynamicMemoryWStream ostream; - ds.writeToStream(&ostream); - SkMemoryStream istream; - istream.setData(ostream.copyToData())->unref(); - SkDataSet copy(&istream); - - test_datasets_equal(reporter, ds, copy); -} - -static void test_dataset(skiatest::Reporter* reporter) { - SkDataSet set0(NULL, 0); - SkDataSet set1("hello", SkAutoTUnref(SkData::NewWithCString("world"))); - - const SkDataSet::Pair pairs[] = { - { "one", SkData::NewWithCString("1") }, - { "two", SkData::NewWithCString("2") }, - { "three", SkData::NewWithCString("3") }, - }; - SkDataSet set3(pairs, 3); - unrefAll(pairs, 3); - - test_dataset(reporter, set0, 0); - test_dataset(reporter, set1, 1); - test_dataset(reporter, set3, 3); -} - static void* gGlobal; static void delete_int_proc(const void* ptr, size_t len, void* context) { @@ -318,7 +252,6 @@ static void TestData(skiatest::Reporter* reporter) { tmp->unref(); test_cstring(reporter); - test_dataset(reporter); test_files(reporter); } -- cgit v1.2.3