* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "Test.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
#include "SkMath.h"
#include "SkPaint.h"
+#include "Test.h"
+#include "TestClassDef.h"
+
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "SkGpuDevice.h"
}
}
-///////////////////////////////////////////////////////////////////////////////
-
-static void test_blur(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(Blur, reporter, factory) {
test_blur_drawing(reporter);
test_sigma_range(reporter, factory);
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("BlurMaskFilter", BlurTestClass, test_blur)
* found in the LICENSE file.
*/
-
#include "Test.h"
+#include "TestClassDef.h"
// This is a GR test
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#endif
}
-////////////////////////////////////////////////////////////////////////////////
-static void TestClipCache(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(ClipCache, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
if (!GrContextFactory::IsRenderingGLContext(glType)) {
}
}
-////////////////////////////////////////////////////////////////////////////////
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache)
-
#endif
-
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "Test.h"
+#include "TestClassDef.h"
#include "SkBitmap.h"
#include "SkBitmapDevice.h"
#include "SkBitmapProcShader.h"
REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount == 1);
}
-static void TestDeferredCanvas(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(DeferredCanvas, reporter, factory) {
TestDeferredCanvasBitmapAccess(reporter);
TestDeferredCanvasFlush(reporter);
TestDeferredCanvasFreshFrame(reporter);
TestDeferredCanvasSetSurface(reporter, factory);
}
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanvas)
-
/*
* Copyright 2011 Google Inc.
*
* found in the LICENSE file.
*/
-
-
#include "Test.h"
+#include "TestClassDef.h"
+
// This is a GPU-backend specific test
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
-static void GLInterfaceValidationTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
// this forces the factory to make the context if it hasn't yet
}
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GLInterfaceValidation",
- GLInterfaceValidationTestClass,
- GLInterfaceValidationTest)
-
#endif
#include "SkChecksum.h"
#include "SkRandom.h"
#include "Test.h"
+#include "TestClassDef.h"
void GrGLProgramDesc::setRandom(SkRandom* random,
const GrGpuGL* gpu,
return true;
}
-static void GLProgramsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GLPrograms, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(type));
if (NULL != context) {
}
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GLPrograms", GLProgramsTestClass, GLProgramsTest)
-
// This is evil evil evil. The linker may throw away whole translation units as dead code if it
// thinks none of the functions are called. It will do this even if there are static initializers
// in the unit that could pass pointers to functions from the unit out to other translation units!
#include "SkPixelRef.h"
#include "SkRect.h"
#include "Test.h"
+#include "TestClassDef.h"
static const char* boolStr(bool value) {
return value ? "true" : "false";
// Stripped down version of TestBitmapCopy that checks basic fields (width, height, config, genID)
// to ensure that they were copied properly.
-static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GpuBitmapCopy, reporter, factory) {
#ifdef SK_BUILD_FOR_ANDROID // https://code.google.com/p/skia/issues/detail?id=753
return;
#endif
} // GrContextFactory::GLContextType
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy)
-
#endif
#include "GrContextFactory.h"
#include "GrEffect.h"
#include "SkColorFilter.h"
-#include "Test.h"
#include "SkGr.h"
-
-namespace {
+#include "Test.h"
+#include "TestClassDef.h"
static GrColor filterColor(const GrColor& color, uint32_t flags) {
uint32_t mask = 0;
}
}
-static void TestGpuColorFilter(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GpuColorFilter, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
}
}
-}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GpuColorFilter", TestGpuColorFilterClass, TestGpuColorFilter)
-
#endif
-
/*
* Copyright 2013 Google Inc.
*
#include "SkRect.h"
#include "SkRRect.h"
#include "Test.h"
+#include "TestClassDef.h"
-static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas)
-{
+static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas) {
// Filling an empty path should not crash.
SkPaint paint;
canvas->drawRect(SkRect(), paint);
}
-static void TestGpuDrawPath(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GpuDrawPath, reporter, factory) {
return;
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
}
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GpuDrawPath", TestGpuDrawPathClass, TestGpuDrawPath)
-
#endif
* found in the LICENSE file.
*/
-#include "Test.h"
-
-// This is a GPU-backend specific test
#if SK_SUPPORT_GPU
+
#include "GrContextFactory.h"
+#include "Test.h"
+#include "TestClassDef.h"
-static void test_context_factory(skiatest::Reporter* reporter,
- GrContextFactory* contextFactory) {
+DEF_GPUTEST(GrContextFactoryTest, reporter, factory) {
// Reset in case some other test has been using it first.
- contextFactory->destroyContexts();
+ factory->destroyContexts();
// Before we ask for a context, we expect the GL context to not be there.
REPORTER_ASSERT(reporter,
- NULL == contextFactory->getGLContext(GrContextFactory::kNative_GLContextType));
+ NULL == factory->getGLContext(GrContextFactory::kNative_GLContextType));
// After we ask for a context, we expect that the GL context to be there.
- contextFactory->get(GrContextFactory::kNative_GLContextType);
+ factory->get(GrContextFactory::kNative_GLContextType);
REPORTER_ASSERT(reporter,
- contextFactory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
+ factory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
// If we did not ask for a context with the particular GL context, we would
// expect the particular GL context to not be there.
REPORTER_ASSERT(reporter,
- NULL == contextFactory->getGLContext(GrContextFactory::kNull_GLContextType));
+ NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GrContextFactory", GrContextFactoryClass, test_context_factory);
-
#endif
#include "GrGpu.h"
#include "GrDrawTargetCaps.h"
#include "Test.h"
+#include "TestClassDef.h"
static void test_print(skiatest::Reporter*, const GrDrawTargetCaps* caps) {
// This used to assert.
SkASSERT(!result.isEmpty());
}
-static void TestGrDrawTarget(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GrDrawTarget, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
}
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GrDrawTarget", TestGrDrawTargetClass, TestGrDrawTarget)
-
#endif
-
/*
* Copyright 2013 Google Inc.
*
* found in the LICENSE file.
*/
-// This is a GPU-backend specific test.
-
-#include "SkTypes.h"
-
#if SK_SUPPORT_GPU
-#include "Test.h"
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrRenderTarget.h"
#include "GrTexture.h"
+#include "SkTypes.h"
+#include "Test.h"
+#include "TestClassDef.h"
-static void GrSurfaceIsSameTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(GrSurfaceTest, reporter, factory) {
GrContext* context = factory->get(GrContextFactory::kNull_GLContextType);
if (NULL != context) {
GrTextureDesc desc;
}
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("GrSurfaceIsSame", GrSurfaceIsSameTestClass, GrSurfaceIsSameTest)
-
#endif
* found in the LICENSE file.
*/
-#include "Test.h"
+#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkConfig8888.h"
-#include "SkBitmapDevice.h"
+#include "Test.h"
+#include "TestClassDef.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
SkCanvas::kRGBA_Unpremul_Config8888,
};
-static void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(PremulAlphaRoundTrip, reporter, factory) {
SkAutoTUnref<SkBaseDevice> device;
for (int dtype = 0; dtype < 2; ++dtype) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, PremulAlphaRoundTripTest)
* found in the LICENSE file.
*/
-#include "Test.h"
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkMathPriv.h"
#include "SkRegion.h"
+#include "Test.h"
+#include "TestClassDef.h"
+
#if SK_SUPPORT_GPU
#include "SkGpuDevice.h"
#include "GrContextFactory.h"
}
}
-static void ReadPixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(ReadPixels, reporter, factory) {
const SkIRect testRects[] = {
// entire thing
DEV_RECT,
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("ReadPixels", ReadPixelsTestClass, ReadPixelsTest)
-
/*
* Copyright 2012 Google Inc.
*
// This test is specific to the GPU backend.
#if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID)
-#include "Test.h"
-#include "SkGpuDevice.h"
#include "GrContextFactory.h"
+#include "SkGpuDevice.h"
+#include "Test.h"
+#include "TestClassDef.h"
static const int X_SIZE = 12;
static const int Y_SIZE = 12;
-static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(ReadWriteAlpha, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
if (!GrContextFactory::IsRenderingGLContext(glType)) {
}
}
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTest)
-
#endif
* found in the LICENSE file.
*/
-#include "Test.h"
-
-// This is a GPU test
#if SK_SUPPORT_GPU
+
#include "GrContextFactory.h"
#include "SkGpuDevice.h"
+#include "Test.h"
+#include "TestClassDef.h"
static const int gWidth = 640;
static const int gHeight = 480;
context->setTextureCacheLimits(oldMaxNum, oldMaxBytes);
}
-////////////////////////////////////////////////////////////////////////////////
-static void TestResourceCache(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(ResourceCache, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
if (!GrContextFactory::IsRenderingGLContext(glType)) {
}
}
-////////////////////////////////////////////////////////////////////////////////
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("ResourceCache", ResourceCacheTestClass, TestResourceCache)
-
#endif
-
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SkCanvas.h"
#include "SkRRect.h"
#include "SkSurface.h"
#include "Test.h"
+#include "TestClassDef.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
}
-static void TestSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(Surface, reporter, factory) {
TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL);
TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL);
}
#endif
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface)
e.g.
#include "TestClassDef.h"
- DEF_TEST(some_test_name, r) {
+ DEF_TEST(TestName, reporter) {
...
- REPORTER_ASSERT(r, x == 15);
+ REPORTER_ASSERT(reporter, x == 15);
}
*/
} \
static void name(skiatest::Reporter* reporter)
-#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) SK_OVERRIDE { name->set(uiname); } \
- virtual void onRun(Reporter* reporter) SK_OVERRIDE { \
- function(reporter, GetGrContextFactory()); \
- } \
- }; \
- static TestRegistry gReg_##classname(classname::Factory); \
- }
+#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)
* found in the LICENSE file.
*/
-#include "Test.h"
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkMathPriv.h"
#include "SkRegion.h"
+#include "Test.h"
+#include "TestClassDef.h"
+
#if SK_SUPPORT_GPU
#include "SkGpuDevice.h"
#include "GrContextFactory.h"
return true;
}
-static void WritePixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
+DEF_GPUTEST(WritePixels, reporter, factory) {
SkCanvas canvas;
const SkIRect testRects[] = {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_GPUTESTCLASS("WritePixels", WritePixelsTestClass, WritePixelsTest)