| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #ifndef skiatest_Test_DEFINED | 7 #ifndef skiatest_Test_DEFINED |
| 8 #define skiatest_Test_DEFINED | 8 #define skiatest_Test_DEFINED |
| 9 | 9 |
| 10 #include "SkString.h" | 10 #include "SkString.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #if SK_SUPPORT_GPU | 81 #if SK_SUPPORT_GPU |
| 82 using GrContextFactoryContextType = sk_gpu_test::GrContextFactory::ContextType; | 82 using GrContextFactoryContextType = sk_gpu_test::GrContextFactory::ContextType; |
| 83 #else | 83 #else |
| 84 using GrContextFactoryContextType = int; | 84 using GrContextFactoryContextType = int; |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 typedef void GrContextTestFn(Reporter*, const sk_gpu_test::ContextInfo&); | 87 typedef void GrContextTestFn(Reporter*, const sk_gpu_test::ContextInfo&); |
| 88 typedef bool GrContextTypeFilterFn(GrContextFactoryContextType); | 88 typedef bool GrContextTypeFilterFn(GrContextFactoryContextType); |
| 89 | 89 |
| 90 extern bool IsGLContextType(GrContextFactoryContextType); | 90 extern bool IsGLContextType(GrContextFactoryContextType); |
| 91 extern bool IsVulkanContextType(GrContextFactoryContextType); |
| 91 extern bool IsRenderingGLContextType(GrContextFactoryContextType); | 92 extern bool IsRenderingGLContextType(GrContextFactoryContextType); |
| 92 extern bool IsNullGLContextType(GrContextFactoryContextType); | 93 extern bool IsNullGLContextType(GrContextFactoryContextType); |
| 93 | 94 |
| 94 void RunWithGPUTestContexts(GrContextTestFn*, GrContextTypeFilterFn*, | 95 void RunWithGPUTestContexts(GrContextTestFn*, GrContextTypeFilterFn*, |
| 95 Reporter*, sk_gpu_test::GrContextFactory*); | 96 Reporter*, sk_gpu_test::GrContextFactory*); |
| 96 | 97 |
| 97 /** Timer provides wall-clock duration since its creation. */ | 98 /** Timer provides wall-clock duration since its creation. */ |
| 98 class Timer { | 99 class Timer { |
| 99 public: | 100 public: |
| 100 /** Starts the timer. */ | 101 /** Starts the timer. */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 skiatest::Test(#name, true, test_gpu_contexts_##name));
\ | 167 skiatest::Test(#name, true, test_gpu_contexts_##name));
\ |
| 167 void test_##name(skiatest::Reporter* reporter,
\ | 168 void test_##name(skiatest::Reporter* reporter,
\ |
| 168 const sk_gpu_test::ContextInfo& context_info) | 169 const sk_gpu_test::ContextInfo& context_info) |
| 169 | 170 |
| 170 #define DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(name, reporter, context_info)
\ | 171 #define DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(name, reporter, context_info)
\ |
| 171 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsGLContextType, reporter, con
text_info) | 172 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsGLContextType, reporter, con
text_info) |
| 172 #define DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(name, reporter, context_info)
\ | 173 #define DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(name, reporter, context_info)
\ |
| 173 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsRenderingGLContextType, repo
rter, context_info) | 174 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsRenderingGLContextType, repo
rter, context_info) |
| 174 #define DEF_GPUTEST_FOR_NULLGL_CONTEXT(name, reporter, context_info)
\ | 175 #define DEF_GPUTEST_FOR_NULLGL_CONTEXT(name, reporter, context_info)
\ |
| 175 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsNullGLContextType, reporter,
context_info) | 176 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsNullGLContextType, reporter,
context_info) |
| 177 #define DEF_GPUTEST_FOR_VULKAN_CONTEXT(name, reporter, context_info)
\ |
| 178 DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsVulkanContextType, reporter,
context_info) |
| 176 | 179 |
| 177 #define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ | 180 #define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ |
| 178 do { \ | 181 do { \ |
| 179 SkDynamicMemoryWStream testStream; \ | 182 SkDynamicMemoryWStream testStream; \ |
| 180 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ | 183 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ |
| 181 if (!testDoc) { \ | 184 if (!testDoc) { \ |
| 182 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ | 185 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ |
| 183 return; \ | 186 return; \ |
| 184 } \ | 187 } \ |
| 185 } while (false) | 188 } while (false) |
| 186 | 189 |
| 187 #endif | 190 #endif |
| OLD | NEW |