Index: tests/OnceTest.cpp |
diff --git a/tests/OnceTest.cpp b/tests/OnceTest.cpp |
index f9ab427c16439f95afe1561a554fac504ef02856..3a99c39d5396f82fc1d2b770425cc032ee6ca064 100644 |
--- a/tests/OnceTest.cpp |
+++ b/tests/OnceTest.cpp |
@@ -77,3 +77,15 @@ DEF_TEST(SkOnce_Multithreaded, r) { |
// Only one should have done the +=. |
REPORTER_ASSERT(r, 6 == x); |
} |
+ |
+// Test that the atExit option works. |
+static int gToDecrement = 1; |
+static void noop(int) {} |
+static void decrement() { gToDecrement--; } |
+static void checkDecremented() { SkASSERT(gToDecrement == 0); } |
+ |
+DEF_TEST(SkOnce_atExit, r) { |
+ atexit(checkDecremented); |
+ SK_DECLARE_STATIC_ONCE(once); |
+ SkOnce(&once, noop, 0, decrement); |
+} |