reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 1 | /* 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] | 2 | customized class + global definition. |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 3 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 4 | e.g. |
| 5 | #include "TestClassDef.h" |
| 6 | DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction) |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 7 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 8 | where MyTestFunction is declared as |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 9 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 10 | void MyTestFunction(skiatest::Reporter*) |
| 11 | */ |
| 12 | |
| 13 | #define DEFINE_TESTCLASS(uiname, classname, function) \ |
| 14 | namespace skiatest { \ |
| 15 | class classname : public Test { \ |
| 16 | public: \ |
| 17 | static Test* Factory(void*) { return SkNEW(classname); } \ |
| 18 | protected: \ |
| 19 | virtual void onGetName(SkString* name) { name->set(uiname); } \ |
| 20 | virtual void onRun(Reporter* reporter) { function(reporter); } \ |
| 21 | }; \ |
| 22 | static TestRegistry gReg(classname::Factory); \ |
| 23 | } |
| 24 | |