epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 8 | /* This file is meant to be included by .cpp files, so it can spew out a |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 9 | customized class + global definition. |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 10 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 11 | e.g. |
| 12 | #include "TestClassDef.h" |
| 13 | DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction) |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 14 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 15 | where MyTestFunction is declared as |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 16 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 17 | void MyTestFunction(skiatest::Reporter*) |
| 18 | */ |
| 19 | |
bsalomon@google.com | 67b915d | 2013-02-04 16:13:32 +0000 | [diff] [blame^] | 20 | #define DEFINE_TESTCLASS(uiname, classname, function) \ |
| 21 | namespace skiatest { \ |
| 22 | class classname : public Test { \ |
| 23 | public: \ |
| 24 | static Test* Factory(void*) { return SkNEW(classname); } \ |
| 25 | protected: \ |
| 26 | virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uiname); } \ |
| 27 | virtual void onRun(Reporter* reporter) SK_OVERRIDE { function(reporter); } \ |
| 28 | }; \ |
| 29 | static TestRegistry gReg(classname::Factory); \ |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 30 | } |
| 31 | |
bsalomon@google.com | 67b915d | 2013-02-04 16:13:32 +0000 | [diff] [blame^] | 32 | #define DEFINE_GPUTESTCLASS(uiname, classname, function) \ |
| 33 | namespace skiatest { \ |
| 34 | class classname : public GpuTest { \ |
| 35 | public: \ |
| 36 | static Test* Factory(void*) { return SkNEW(classname); } \ |
| 37 | protected: \ |
| 38 | virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uiname); } \ |
| 39 | virtual void onRun(Reporter* reporter) SK_OVERRIDE { \ |
| 40 | function(reporter, GetGrContextFactory()); \ |
| 41 | } \ |
| 42 | }; \ |
| 43 | static TestRegistry gReg(classname::Factory); \ |
bsalomon@google.com | a8e686e | 2011-08-16 15:45:58 +0000 | [diff] [blame] | 44 | } |