aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/TestClassDef.h
blob: 0773f5a31e9627a1ff70d4659e83effc7dbb91de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*  This file is meant to be included by .cpp files, so it can spew out a
    customized class + global definition.

    e.g.
    #include "TestClassDef.h"
    DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction)

    where MyTestFunction is declared as

        void MyTestFunction(skiatest::Reporter*)
*/

#define DEFINE_TESTCLASS(uiname, classname, function)                       \
    namespace skiatest {                                                    \
        class classname : public Test {                                     \
        public:                                                             \
            static Test* Factory(void*) { return SkNEW(classname); }        \
        protected:                                                          \
            virtual void onGetName(SkString* name) { name->set(uiname); }   \
            virtual void onRun(Reporter* reporter) { function(reporter); }  \
        };                                                                  \
        static TestRegistry gReg(classname::Factory);                       \
    }