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

Unified Diff: tests/RefCntTest.cpp

Issue 1760453004: Add operator* and operator safe-bool to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Correct signature, write test. Created 4 years, 10 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
« include/core/SkRefCnt.h ('K') | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RefCntTest.cpp
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index bda45317bcc76abf6915b5a1f7d082ce24f4b5be..dcfad2437ceec3d5c3f12bb827f718c6b4c9e29f 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -164,9 +164,21 @@ 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);
+ }
+
paint.set(nullptr);
check(reporter, 0, 1, 1, 1);
+ if (paint.get()) {
+ REPORTER_ASSERT(reporter, false);
+ } else {
+ REPORTER_ASSERT(reporter, true);
+ }
+
auto e = Create();
REPORTER_ASSERT(reporter, sizeof(e) == sizeof(void*));
@@ -180,7 +192,7 @@ DEF_TEST(sk_sp, reporter) {
check(reporter, 2, 1, 2, 1);
REPORTER_ASSERT(reporter, paint.fEffect.get()->fRefCnt == 3);
- delete paint.get()->method();
+ delete (*paint.get()).method();
mtklein 2016/03/02 20:05:10 // tests operator*
check(reporter, 2, 1, 2, 1);
paint.set(nullptr);
« include/core/SkRefCnt.h ('K') | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698