Index: tests/Test.h |
diff --git a/tests/Test.h b/tests/Test.h |
index c1e0c528fb5a0384af7677c860c42e8322f18163..ec6f93022428883dcb57b3f01cc01d97b415bca5 100644 |
--- a/tests/Test.h |
+++ b/tests/Test.h |
@@ -13,6 +13,7 @@ |
#include "SkTypes.h" |
class GrContextFactory; |
+class GrContext; |
namespace skiatest { |
@@ -69,6 +70,18 @@ typedef SkTRegistry<Test> TestRegistry; |
... |
} |
*/ |
+enum GPUTestContexts { |
+ kNone_GPUTestContexts = 0, |
+ kNull_GPUTestContexts = 1, |
+ kNative_GPUTestContexts = 1 << 1, |
+ kOther_GPUTestContexts = 1 << 2, // Other than native, used only for below. |
+ kAllRendering_GPUTestContexts = kNative_GPUTestContexts | kOther_GPUTestContexts, |
+ kAll_GPUTestContexts = kAllRendering_GPUTestContexts | kNull_GPUTestContexts |
+}; |
+void RunWithGPUTestContexts(void(*test)(skiatest::Reporter*, GrContext*), |
+ skiatest::GPUTestContexts, |
+ skiatest::Reporter* reporter, |
+ GrContextFactory* factory); |
} // namespace skiatest |
#define REPORTER_ASSERT(r, cond) \ |
@@ -102,6 +115,25 @@ typedef SkTRegistry<Test> TestRegistry; |
skiatest::Test(#name, true, test_##name)); \ |
void test_##name(skiatest::Reporter* reporter, GrContextFactory* factory) |
+#define DEF_GPUTEST_FOR_CONTEXTS(name, contexts, reporter, context) \ |
+ static void test_##name(skiatest::Reporter*, GrContext*); \ |
+ static void test_gpu_contexts_##name(skiatest::Reporter* reporter, \ |
+ GrContextFactory* factory) { \ |
+ skiatest::RunWithGPUTestContexts(test_##name, contexts, reporter, factory); \ |
+ } \ |
+ skiatest::TestRegistry name##TestRegistry( \ |
+ skiatest::Test(#name, true, test_gpu_contexts_##name)); \ |
+ void test_##name(skiatest::Reporter* reporter, GrContext* context) |
+ |
+#define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, context) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAll_GPUTestContexts, reporter, context) |
+#define DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, context) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAllRendering_GPUTestContexts, reporter, context) |
+#define DEF_GPUTEST_FOR_NULL_CONTEXT(name, reporter, context) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kNull_GPUTestContexts, reporter, context) |
+#define DEF_GPUTEST_FOR_NATIVE_CONTEXT(name, reporter, context) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kNative_GPUTestContexts, reporter, context) |
+ |
#define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ |
do { \ |
SkDynamicMemoryWStream testStream; \ |