| 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" |
| 11 #include "SkTRegistry.h" | 11 #include "SkTRegistry.h" |
| 12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 13 | 13 |
| 14 namespace sk_gpu_test { | 14 namespace sk_gpu_test { |
| 15 class GrContextFactory; | 15 class GrContextFactory; |
| 16 class GLTestContext; | 16 class GLContext; |
| 17 } // namespace sk_gpu_test | 17 } // namespace sk_gpu_test |
| 18 class GrContext; | 18 class GrContext; |
| 19 | 19 |
| 20 namespace skiatest { | 20 namespace skiatest { |
| 21 | 21 |
| 22 SkString GetTmpDir(); | 22 SkString GetTmpDir(); |
| 23 | 23 |
| 24 struct Failure { | 24 struct Failure { |
| 25 Failure(const char* f, int l, const char* c, const SkString& m) | 25 Failure(const char* f, int l, const char* c, const SkString& m) |
| 26 : fileName(f), lineNo(l), condition(c), message(m) {} | 26 : fileName(f), lineNo(l), condition(c), message(m) {} |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*)
; \ | 139 static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*)
; \ |
| 140 skiatest::TestRegistry name##TestRegistry(
\ | 140 skiatest::TestRegistry name##TestRegistry(
\ |
| 141 skiatest::Test(#name, false, test_##name));
\ | 141 skiatest::Test(#name, false, test_##name));
\ |
| 142 void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory
*) | 142 void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory
*) |
| 143 | 143 |
| 144 #define GPUTEST_EXPAND_MSVC(x) x | 144 #define GPUTEST_EXPAND_MSVC(x) x |
| 145 #define GPUTEST_APPLY(C, ...) GPUTEST_EXPAND_MSVC(C(__VA_ARGS__)) | 145 #define GPUTEST_APPLY(C, ...) GPUTEST_EXPAND_MSVC(C(__VA_ARGS__)) |
| 146 #define GPUTEST_SELECT(a1, a2, N, ...) N | 146 #define GPUTEST_SELECT(a1, a2, N, ...) N |
| 147 | 147 |
| 148 #define GPUTEST_CONTEXT_ARGS1(a1) GrContext* a1 | 148 #define GPUTEST_CONTEXT_ARGS1(a1) GrContext* a1 |
| 149 #define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLTestContext*
a2 | 149 #define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLContext* a2 |
| 150 #define GPUTEST_CONTEXT_ARGS(...)
\ | 150 #define GPUTEST_CONTEXT_ARGS(...)
\ |
| 151 GPUTEST_APPLY(GPUTEST_SELECT(__VA_ARGS__, GPUTEST_CONTEXT_ARGS2, GPUTEST_CON
TEXT_ARGS1), \ | 151 GPUTEST_APPLY(GPUTEST_SELECT(__VA_ARGS__, GPUTEST_CONTEXT_ARGS2, GPUTEST_CON
TEXT_ARGS1), \ |
| 152 __VA_ARGS__) | 152 __VA_ARGS__) |
| 153 | 153 |
| 154 #define DEF_GPUTEST(name, reporter, factory)
\ | 154 #define DEF_GPUTEST(name, reporter, factory)
\ |
| 155 static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*)
; \ | 155 static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*)
; \ |
| 156 skiatest::TestRegistry name##TestRegistry(
\ | 156 skiatest::TestRegistry name##TestRegistry(
\ |
| 157 skiatest::Test(#name, true, test_##name));
\ | 157 skiatest::Test(#name, true, test_##name));
\ |
| 158 void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory
* factory) | 158 void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory
* factory) |
| 159 | 159 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 180 do { \ | 180 do { \ |
| 181 SkDynamicMemoryWStream testStream; \ | 181 SkDynamicMemoryWStream testStream; \ |
| 182 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ | 182 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ |
| 183 if (!testDoc) { \ | 183 if (!testDoc) { \ |
| 184 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ | 184 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ |
| 185 return; \ | 185 return; \ |
| 186 } \ | 186 } \ |
| 187 } while (false) | 187 } while (false) |
| 188 | 188 |
| 189 #endif | 189 #endif |
| OLD | NEW |