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

Unified Diff: tests/DataRefTest.cpp

Issue 27208002: remove SkDataSet, and just store a key/value in SkAnnotation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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/ports/SkGlobalInitialization_default.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DataRefTest.cpp
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 313a61066d3d273b165ff4e040e93f0885f049f9..9043a58722a3870e7a1656015d4df79e6b303327 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>(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);
}
« no previous file with comments | « src/ports/SkGlobalInitialization_default.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698