Index: tests/Test.h |
diff --git a/tests/Test.h b/tests/Test.h |
index 7430372e7d9a3fb6586323faa1bb08d23d8fa335..de99fa53e030ce9d952d64915a5b1ba6d4a009cc 100644 |
--- a/tests/Test.h |
+++ b/tests/Test.h |
@@ -11,11 +11,16 @@ |
#include "SkTRegistry.h" |
#include "SkTypes.h" |
+#if SK_SUPPORT_GPU |
+#include "GrContextFactory.h" |
+#else |
namespace sk_gpu_test { |
class GrContextFactory; |
+class ContextInfo; |
class GLTestContext; |
} // namespace sk_gpu_test |
class GrContext; |
+#endif |
namespace skiatest { |
@@ -83,9 +88,11 @@ enum GPUTestContexts { |
| kNull_GPUTestContexts |
| kDebug_GPUTestContexts |
}; |
-template<typename T> |
-void RunWithGPUTestContexts(T testFunction, GPUTestContexts contexts, Reporter* reporter, |
- sk_gpu_test::GrContextFactory* factory); |
+ |
+typedef void GrContextTestFn(Reporter*, const sk_gpu_test::ContextInfo&); |
+ |
+void RunWithGPUTestContexts(GrContextTestFn* testFunction, GPUTestContexts contexts, |
+ Reporter* reporter, sk_gpu_test::GrContextFactory* factory); |
/** Timer provides wall-clock duration since its creation. */ |
class Timer { |
@@ -141,38 +148,32 @@ private: |
skiatest::Test(#name, false, test_##name)); \ |
void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory*) |
-#define GPUTEST_EXPAND_MSVC(x) x |
-#define GPUTEST_APPLY(C, ...) GPUTEST_EXPAND_MSVC(C(__VA_ARGS__)) |
-#define GPUTEST_SELECT(a1, a2, N, ...) N |
-#define GPUTEST_CONTEXT_ARGS1(a1) GrContext* a1 |
-#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLTestContext* a2 |
-#define GPUTEST_CONTEXT_ARGS(...) \ |
- GPUTEST_APPLY(GPUTEST_SELECT(__VA_ARGS__, GPUTEST_CONTEXT_ARGS2, GPUTEST_CONTEXT_ARGS1), \ |
- __VA_ARGS__) |
- |
-#define DEF_GPUTEST(name, reporter, factory) \ |
- static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*); \ |
- skiatest::TestRegistry name##TestRegistry( \ |
- skiatest::Test(#name, true, test_##name)); \ |
+#define DEF_GPUTEST(name, reporter, factory) \ |
+ static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*); \ |
+ skiatest::TestRegistry name##TestRegistry( \ |
+ skiatest::Test(#name, true, test_##name)); \ |
void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory* factory) |
-#define DEF_GPUTEST_FOR_CONTEXTS(name, contexts, reporter, ...) \ |
- static void test_##name(skiatest::Reporter*, GPUTEST_CONTEXT_ARGS(__VA_ARGS__)); \ |
- static void test_gpu_contexts_##name(skiatest::Reporter* reporter, \ |
- sk_gpu_test::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, GPUTEST_CONTEXT_ARGS(__VA_ARGS__)) |
- |
-#define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, ...) \ |
- DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAll_GPUTestContexts, reporter, __VA_ARGS__) |
-#define DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, ...) \ |
- DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAllRendering_GPUTestContexts, reporter, __VA_ARGS__) |
-#define DEF_GPUTEST_FOR_NULL_CONTEXT(name, reporter, ...) \ |
- DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kNull_GPUTestContexts, reporter, __VA_ARGS__) |
+#define DEF_GPUTEST_FOR_CONTEXTS(name, contexts, reporter, context_info) \ |
+ static void test_##name(skiatest::Reporter*, \ |
+ const sk_gpu_test::ContextInfo& context_info); \ |
+ static void test_gpu_contexts_##name(skiatest::Reporter* reporter, \ |
+ sk_gpu_test::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, \ |
+ const sk_gpu_test::ContextInfo& context_info) |
+ |
+#define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, context_info) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAll_GPUTestContexts, reporter, context_info) |
+#define DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAllRendering_GPUTestContexts, reporter, \ |
+ context_info) |
+#define DEF_GPUTEST_FOR_NULL_CONTEXT(name, reporter, context_info) \ |
+ DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kNull_GPUTestContexts, reporter, context_info) |
#define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ |
do { \ |