9dfb7577c4
TBR: http://codereview.appspot.com/4946041/ git-svn-id: http://skia.googlecode.com/svn/trunk@2167 2bbb7eff-a529-9590-31e7-b0007b416f81
47 lines
2.3 KiB
C++
47 lines
2.3 KiB
C++
|
|
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
/* 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); \
|
|
}
|
|
|
|
#define DEFINE_GPUTESTCLASS(uiname, classname, function) \
|
|
namespace skiatest { \
|
|
class classname : public GpuTest { \
|
|
public: \
|
|
static Test* Factory(void*) { return SkNEW(classname); } \
|
|
protected: \
|
|
virtual void onGetName(SkString* name) { name->set(uiname); } \
|
|
virtual void onRun(Reporter* reporter) { \
|
|
if (fContext) { \
|
|
function(reporter, fContext); \
|
|
} \
|
|
} \
|
|
}; \
|
|
static TestRegistry gReg(classname::Factory); \
|
|
}
|