4ee16bfaed
This macro is similar to DEF_TEST() and simplifies the process of setting up a GPU test. BUG=skia:1952 TEST=tests R=mtklein@google.com Review URL: https://codereview.chromium.org/132293005 git-svn-id: http://skia.googlecode.com/svn/trunk@13033 2bbb7eff-a529-9590-31e7-b0007b416f81
49 lines
2.7 KiB
C++
49 lines
2.7 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"
|
|
|
|
DEF_TEST(TestName, reporter) {
|
|
...
|
|
REPORTER_ASSERT(reporter, x == 15);
|
|
}
|
|
*/
|
|
|
|
#define DEF_TEST(name, reporter) \
|
|
static void name(skiatest::Reporter* reporter); \
|
|
namespace skiatest { \
|
|
class name##Class : public Test { \
|
|
public: \
|
|
static Test* Factory(void*) { return SkNEW(name##Class); } \
|
|
protected: \
|
|
virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name); } \
|
|
virtual void onRun(Reporter* reporter) SK_OVERRIDE { name(reporter); } \
|
|
}; \
|
|
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
|
} \
|
|
static void name(skiatest::Reporter* reporter)
|
|
|
|
#define DEF_GPUTEST(name, reporter, factory) \
|
|
static void name(skiatest::Reporter* reporter, GrContextFactory* factory); \
|
|
namespace skiatest { \
|
|
class name##Class : public GpuTest { \
|
|
public: \
|
|
static Test* Factory(void*) { return SkNEW(name##Class); } \
|
|
protected: \
|
|
virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name); } \
|
|
virtual void onRun(Reporter* reporter) SK_OVERRIDE { \
|
|
name(reporter, GetGrContextFactory()); \
|
|
} \
|
|
}; \
|
|
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
|
} \
|
|
static void name(skiatest::Reporter* reporter, GrContextFactory* factory)
|