Preprend Test to test function name generated by DEF_TEST() macro.
That way when declaring a test with DEF_TEST() macro, you don't have to uniquify the test name because it might colide with the class it is being testing. For example, if you are testing SkBase64 and do: DEF_TEST(SkBase64, reporter) { } That will generate an error because the macro will declare a function named SkBase64 which colides with the type SkBase64. By adding Test to the function name we avoid this problem. Fixed the entries found with the following command line: $ git grep "Test, r" | grep DEF BUG=None TEST=make tests && out/Debug/tests R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/345753007
This commit is contained in:
parent
5da2fa436e
commit
9ea53f93e7
@ -12,7 +12,7 @@
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
DEF_TEST(GrBinHashKeyTest, reporter) {
|
||||
DEF_TEST(GrBinHashKey, reporter) {
|
||||
const char* testStringA_ = "abcdABCD";
|
||||
const char* testStringB_ = "abcdBBCD";
|
||||
const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "GrContextFactory.h"
|
||||
#include "Test.h"
|
||||
|
||||
DEF_GPUTEST(GrContextFactoryTest, reporter, factory) {
|
||||
DEF_GPUTEST(GrContextFactory, reporter, factory) {
|
||||
// Reset in case some other test has been using it first.
|
||||
factory->destroyContexts();
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
typedef GrOrderedSet<int> Set;
|
||||
typedef GrOrderedSet<const char*, GrStrLess> Set2;
|
||||
|
||||
DEF_TEST(GrOrderedSetTest, reporter) {
|
||||
DEF_TEST(GrOrderedSet, reporter) {
|
||||
Set set;
|
||||
|
||||
REPORTER_ASSERT(reporter, set.empty());
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
typedef GrRedBlackTree<int> Tree;
|
||||
|
||||
DEF_TEST(GrRedBlackTreeTest, reporter) {
|
||||
DEF_TEST(GrRedBlackTree, reporter) {
|
||||
Tree tree;
|
||||
|
||||
SkRandom r;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "SkTypes.h"
|
||||
#include "Test.h"
|
||||
|
||||
DEF_GPUTEST(GrSurfaceTest, reporter, factory) {
|
||||
DEF_GPUTEST(GrSurface, reporter, factory) {
|
||||
GrContext* context = factory->get(GrContextFactory::kNull_GLContextType);
|
||||
if (NULL != context) {
|
||||
GrTextureDesc desc;
|
||||
|
@ -22,7 +22,7 @@ static bool EQ(const int& elem, int value) {
|
||||
|
||||
#include "GrTBSearch.h"
|
||||
|
||||
DEF_TEST(GrTBSearchTest, reporter) {
|
||||
DEF_TEST(GrTBSearch, reporter) {
|
||||
const int array[] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99
|
||||
};
|
||||
|
@ -464,7 +464,7 @@ DEF_TEST(ImageFilterCropRect, reporter) {
|
||||
test_crop_rects(&device, reporter);
|
||||
}
|
||||
|
||||
DEF_TEST(ImageFilterMatrixTest, reporter) {
|
||||
DEF_TEST(ImageFilterMatrix, reporter) {
|
||||
SkBitmap temp;
|
||||
temp.allocN32Pixels(100, 100);
|
||||
SkBitmapDevice device(temp);
|
||||
@ -494,8 +494,7 @@ DEF_TEST(ImageFilterMatrixTest, reporter) {
|
||||
canvas.drawPicture(picture);
|
||||
}
|
||||
|
||||
DEF_TEST(ImageFilterPictureImageFilterTest, reporter) {
|
||||
|
||||
DEF_TEST(ImageFilterPictureImageFilter, reporter) {
|
||||
SkRTreeFactory factory;
|
||||
SkPictureRecorder recorder;
|
||||
SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0);
|
||||
@ -554,8 +553,7 @@ DEF_TEST(ImageFilterPictureImageFilterTest, reporter) {
|
||||
REPORTER_ASSERT(reporter, pixel != SK_ColorGREEN);
|
||||
}
|
||||
|
||||
DEF_TEST(ImageFilterEmptySaveLayerTest, reporter) {
|
||||
|
||||
DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
|
||||
// Even when there's an empty saveLayer()/restore(), ensure that an image
|
||||
// filter or color filter which affects transparent black still draws.
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
// Minimally exercise the public SkRecording API.
|
||||
|
||||
DEF_TEST(RecordingTest, r) {
|
||||
DEF_TEST(SkRecording, r) {
|
||||
EXPERIMENTAL::SkRecording recording(1920, 1080);
|
||||
|
||||
// Some very exciting commands here.
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
DEF_TEST(SkBase64Test, reporter) {
|
||||
DEF_TEST(SkBase64, reporter) {
|
||||
char all[256];
|
||||
for (int index = 0; index < 256; ++index) {
|
||||
all[index] = (signed char) (index + 1);
|
||||
|
64
tests/Test.h
64
tests/Test.h
@ -138,38 +138,38 @@ namespace skiatest {
|
||||
(reporter)->reportFailed(desc); \
|
||||
} while(0)
|
||||
|
||||
#define DEF_TEST(name, reporter) \
|
||||
static void name(skiatest::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* r) SK_OVERRIDE { name(r); } \
|
||||
}; \
|
||||
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
||||
} \
|
||||
static void name(skiatest::Reporter* reporter)
|
||||
#define DEF_TEST(name, reporter) \
|
||||
static void test_##name(skiatest::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* r) SK_OVERRIDE { test_##name(r); } \
|
||||
}; \
|
||||
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
||||
} \
|
||||
static void test_##name(skiatest::Reporter* reporter)
|
||||
|
||||
#define DEF_GPUTEST(name, reporter, factory) \
|
||||
static void name(skiatest::Reporter*, GrContextFactory*); \
|
||||
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* r) SK_OVERRIDE { \
|
||||
name(r, fGrContextFactory); \
|
||||
} \
|
||||
}; \
|
||||
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
||||
} \
|
||||
static void name(skiatest::Reporter* reporter, GrContextFactory* factory)
|
||||
#define DEF_GPUTEST(name, reporter, factory) \
|
||||
static void test_##name(skiatest::Reporter*, GrContextFactory*); \
|
||||
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* r) SK_OVERRIDE { \
|
||||
test_##name(r, fGrContextFactory); \
|
||||
} \
|
||||
}; \
|
||||
static TestRegistry gReg_##name##Class(name##Class::Factory); \
|
||||
} \
|
||||
static void test_##name(skiatest::Reporter* reporter, GrContextFactory* factory)
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "SkRTConf.h"
|
||||
#include "Test.h"
|
||||
|
||||
DEF_TEST(UnitTest, reporter) {
|
||||
DEF_TEST(SkRTConfRegistry, reporter) {
|
||||
#ifdef SK_SUPPORT_UNITTEST
|
||||
SkRTConfRegistry::UnitTest();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user