blob: 46abf18283edaccd81160b81eb83efcf428da165 [file] [log] [blame]
Brian Salomon5ec9def2016-12-20 15:34:05 -05001/*
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. */
Brian Salomonf8334782017-01-03 09:42:58 -050021std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*);
Brian Salomon5ec9def2016-12-20 15:34:05 -050022
23/** GrDrawOp subclasses should define test factory functions using this macro. */
Brian Salomonf8334782017-01-03 09:42:58 -050024#define DRAW_OP_TEST_DEFINE(Op) \
25 std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context)
Brian Salomon5ec9def2016-12-20 15:34:05 -050026
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) \
Brian Salomonf8334782017-01-03 09:42:58 -050029 friend std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context);
Brian Salomon5ec9def2016-12-20 15:34:05 -050030
31#endif
32#endif