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

Unified Diff: tests/OnceTest.cpp

Issue 104433005: SkOnce: let f be any functor, update comments (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tests SkOnceFlag was uninitialized Created 7 years 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/core/SkScaledImageCache.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/OnceTest.cpp
diff --git a/tests/OnceTest.cpp b/tests/OnceTest.cpp
index 31c6a85a44cbd50213129f3c265ae8c71773cf55..d3a0a0066a1d8008537459a328a0a016aaa14c86 100644
--- a/tests/OnceTest.cpp
+++ b/tests/OnceTest.cpp
@@ -28,6 +28,20 @@ DEF_TEST(SkOnce_Singlethreaded, r) {
REPORTER_ASSERT(r, 5 == x);
}
+struct AddFour { void operator()(int* x) { *x += 4; } };
+
+DEF_TEST(SkOnce_MiscFeatures, r) {
+ // Tests that we support functors and explicit SkOnceFlags.
+ int x = 0;
+
+ SkOnceFlag once = SK_ONCE_INIT;
+ SkOnce(&once, AddFour(), &x);
+ SkOnce(&once, AddFour(), &x);
+ SkOnce(&once, AddFour(), &x);
+
+ REPORTER_ASSERT(r, 4 == x);
+}
+
static void add_six(int* x) {
*x += 6;
}
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698