Index: tests/RefCntTest.cpp |
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp |
index bda45317bcc76abf6915b5a1f7d082ce24f4b5be..60a34ecf886826ecaa972ac612c18ee1d1d8a702 100644 |
--- a/tests/RefCntTest.cpp |
+++ b/tests/RefCntTest.cpp |
@@ -164,9 +164,31 @@ DEF_TEST(sk_sp, reporter) { |
check(reporter, 0, 0, 1, 0); |
REPORTER_ASSERT(reporter, paint.fEffect.get()->fRefCnt == 1); |
+ if (paint.get()) { |
+ REPORTER_ASSERT(reporter, true); |
+ } else { |
+ REPORTER_ASSERT(reporter, false); |
+ } |
+ if (!paint.get()) { |
+ REPORTER_ASSERT(reporter, false); |
+ } else { |
+ REPORTER_ASSERT(reporter, true); |
+ } |
+ |
paint.set(nullptr); |
check(reporter, 0, 1, 1, 1); |
+ if (paint.get()) { |
+ REPORTER_ASSERT(reporter, false); |
+ } else { |
+ REPORTER_ASSERT(reporter, true); |
+ } |
+ if (!paint.get()) { |
+ REPORTER_ASSERT(reporter, true); |
+ } else { |
+ REPORTER_ASSERT(reporter, false); |
+ } |
+ |
auto e = Create(); |
REPORTER_ASSERT(reporter, sizeof(e) == sizeof(void*)); |
@@ -180,9 +202,14 @@ DEF_TEST(sk_sp, reporter) { |
check(reporter, 2, 1, 2, 1); |
REPORTER_ASSERT(reporter, paint.fEffect.get()->fRefCnt == 3); |
+ // Test sk_sp::operator-> |
delete paint.get()->method(); |
check(reporter, 2, 1, 2, 1); |
+ // Test sk_sp::operator* |
+ delete (*paint.get()).method(); |
+ check(reporter, 2, 1, 2, 1); |
+ |
paint.set(nullptr); |
e = nullptr; |
paint2.set(nullptr); |