aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RefCntTest.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-08 12:54:48 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-08 12:54:48 -0800
commit647cc8474828202c98d540f799742e3074a2aace (patch)
tree927cedce7eab0ee033068777652ccf30b8b62c76 /tests/RefCntTest.cpp
parent9904c9212074279380e21f96575078734dbbd308 (diff)
Add sk_ref_sp helper function.
Diffstat (limited to 'tests/RefCntTest.cpp')
-rw-r--r--tests/RefCntTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index 2932913c3d..a9b461f352 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -385,3 +385,16 @@ DEF_TEST(sk_sp_reset, r) {
sp.reset(rc); // this should transfer our ownership over to sp
REPORTER_ASSERT(r, rc->unique());
}
+
+DEF_TEST(sk_sp_ref, r) {
+ SkRefCnt* rc = new SkRefCnt;
+ REPORTER_ASSERT(r, rc->unique());
+
+ {
+ sk_sp<SkRefCnt> sp = sk_ref_sp(rc);
+ REPORTER_ASSERT(r, !rc->unique());
+ }
+
+ REPORTER_ASSERT(r, rc->unique());
+ rc->unref();
+}