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; |
} |