2011-07-28 14:26:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2009-04-02 16:59:40 +00:00
|
|
|
/* This file is meant to be included by .cpp files, so it can spew out a
|
2009-02-27 22:06:06 +00:00
|
|
|
customized class + global definition.
|
2009-04-02 16:59:40 +00:00
|
|
|
|
2009-02-27 22:06:06 +00:00
|
|
|
e.g.
|
|
|
|
#include "TestClassDef.h"
|
|
|
|
DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction)
|
2009-04-02 16:59:40 +00:00
|
|
|
|
2009-02-27 22:06:06 +00:00
|
|
|
where MyTestFunction is declared as
|
2009-04-02 16:59:40 +00:00
|
|
|
|
2009-02-27 22:06:06 +00:00
|
|
|
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); \
|
|
|
|
}
|
|
|
|
|
2011-08-16 15:45:58 +00:00
|
|
|
#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) { \
|
2011-08-24 03:29:11 +00:00
|
|
|
if (fContext) { \
|
|
|
|
function(reporter, fContext); \
|
|
|
|
} \
|
2011-08-16 15:45:58 +00:00
|
|
|
} \
|
|
|
|
}; \
|
|
|
|
static TestRegistry gReg(classname::Factory); \
|
|
|
|
}
|