GrDrawOpTest.h revision f8334781914363caf537f22f012fcd5c03c60dad
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrDrawOpTest_DEFINED
9#define GrDrawOpTest_DEFINED
10
11#include "GrTestUtils.h"
12#include "SkRefCnt.h"
13
14#ifdef GR_TEST_UTILS
15
16class GrDrawOp;
17class GrContext;
18class SkRandom;
19
20/**  This function returns a randomly configured GrDrawOp for testing purposes. */
21std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*);
22
23/** GrDrawOp subclasses should define test factory functions using this macro. */
24#define DRAW_OP_TEST_DEFINE(Op) \
25    std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context)
26
27/** This macro may be used if the test factory function must be made a friend of a class. */
28#define DRAW_OP_TEST_FRIEND(Op) \
29    friend std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context);
30
31#endif
32#endif
33