Index: tests/ResourceCacheTest.cpp |
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp |
index b795b01b24899135ec153c77b33174490e3320cb..2231cfee881c44e9bd40344a3ce836f528518818 100644 |
--- a/tests/ResourceCacheTest.cpp |
+++ b/tests/ResourceCacheTest.cpp |
@@ -1223,6 +1223,18 @@ static void test_large_resource_count(skiatest::Reporter* reporter) { |
} |
} |
+static void test_custom_data(skiatest::Reporter* reporter) { |
+ GrUniqueKey key1, key2; |
+ int foo = 4132; |
+ key1.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo))); |
+ REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132); |
+ REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); |
+ |
+ // Test that copying a key also takes a ref on its custom data. |
+ GrUniqueKey key3 = key1; |
+ REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); |
bsalomon
2015/08/03 19:34:54
Can you test that if you stick a resource in the c
Stephen White
2015/08/03 19:52:24
Done.
|
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
DEF_GPUTEST(ResourceCache, reporter, factory) { |
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
@@ -1262,6 +1274,7 @@ DEF_GPUTEST(ResourceCache, reporter, factory) { |
test_timestamp_wrap(reporter); |
test_flush(reporter); |
test_large_resource_count(reporter); |
+ test_custom_data(reporter); |
} |
#endif |