blob: ee4b1397b7218918ee399ba3df4f0f6db2bee5ad [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com80e39a72009-04-02 16:59:40 +00008/* This file is meant to be included by .cpp files, so it can spew out a
reed@android.comd8730ea2009-02-27 22:06:06 +00009 customized class + global definition.
reed@android.com80e39a72009-04-02 16:59:40 +000010
reed@android.comd8730ea2009-02-27 22:06:06 +000011 e.g.
12 #include "TestClassDef.h"
13 DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction)
reed@android.com80e39a72009-04-02 16:59:40 +000014
reed@android.comd8730ea2009-02-27 22:06:06 +000015 where MyTestFunction is declared as
reed@android.com80e39a72009-04-02 16:59:40 +000016
reed@android.comd8730ea2009-02-27 22:06:06 +000017 void MyTestFunction(skiatest::Reporter*)
18*/
19
bsalomon@google.com67b915d2013-02-04 16:13:32 +000020#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.comd8730ea2009-02-27 22:06:06 +000030 }
31
bsalomon@google.com67b915d2013-02-04 16:13:32 +000032#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.coma8e686e2011-08-16 15:45:58 +000044 }