OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 /* This file is meant to be included by .cpp files, so it can spew out a | 8 /* This file is meant to be included by .cpp files, so it can spew out a |
9 customized class + global definition. | 9 customized class + global definition. |
10 | 10 |
11 e.g. | 11 e.g. |
12 #include "TestClassDef.h" | 12 #include "TestClassDef.h" |
13 DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction) | 13 DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction) |
14 | 14 |
15 where MyTestFunction is declared as | 15 where MyTestFunction is declared as |
16 | 16 |
17 void MyTestFunction(skiatest::Reporter*) | 17 void MyTestFunction(skiatest::Reporter*) |
18 */ | 18 */ |
19 | 19 |
20 #define DEFINE_TESTCLASS(uiname, classname, function)
\ | 20 #define DEFINE_TESTCLASS(uiname, classname, function)
\ |
21 namespace skiatest {
\ | 21 namespace skiatest {
\ |
22 class classname : public Test {
\ | 22 class classname : public Test {
\ |
23 public:
\ | 23 public:
\ |
24 static Test* Factory(void*) { return SkNEW(classname); }
\ | 24 static Test* Factory(void*) { return SkNEW(classname); }
\ |
25 protected:
\ | 25 protected:
\ |
26 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam
e); } \ | 26 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam
e); } \ |
27 virtual void onRun(Reporter* reporter) SK_OVERRIDE { function(report
er); } \ | 27 virtual void onRun(Reporter* reporter) SK_OVERRIDE { function(report
er); } \ |
28 };
\ | 28 };
\ |
29 static TestRegistry gReg(classname::Factory);
\ | 29 static TestRegistry gReg_##classname(classname::Factory);
\ |
30 } | 30 } |
31 | 31 |
32 #define DEFINE_GPUTESTCLASS(uiname, classname, function)
\ | 32 #define DEFINE_GPUTESTCLASS(uiname, classname, function)
\ |
33 namespace skiatest {
\ | 33 namespace skiatest {
\ |
34 class classname : public GpuTest {
\ | 34 class classname : public GpuTest {
\ |
35 public:
\ | 35 public:
\ |
36 static Test* Factory(void*) { return SkNEW(classname); }
\ | 36 static Test* Factory(void*) { return SkNEW(classname); }
\ |
37 protected:
\ | 37 protected:
\ |
38 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam
e); } \ | 38 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam
e); } \ |
39 virtual void onRun(Reporter* reporter) SK_OVERRIDE {
\ | 39 virtual void onRun(Reporter* reporter) SK_OVERRIDE {
\ |
40 function(reporter, GetGrContextFactory());
\ | 40 function(reporter, GetGrContextFactory());
\ |
41 }
\ | 41 }
\ |
42 };
\ | 42 };
\ |
43 static TestRegistry gReg(classname::Factory);
\ | 43 static TestRegistry gReg_##classname(classname::Factory);
\ |
44 } | 44 } |
OLD | NEW |