blob: 376022999b98806162ff98e11a22d5863b340636 [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
Hal Canary6f6961e2017-01-31 13:50:44 -050014#if GR_TEST_UTILS
Brian Salomon5ec9def2016-12-20 15:34:05 -050015
Brian Salomon5ec9def2016-12-20 15:34:05 -050016class GrContext;
Brian Salomond3ccb0a2017-04-03 10:38:00 -040017class GrLegacyMeshDrawOp;
Brian Salomon5ec9def2016-12-20 15:34:05 -050018class SkRandom;
19
20/** This function returns a randomly configured GrDrawOp for testing purposes. */
Brian Salomond3ccb0a2017-04-03 10:38:00 -040021std::unique_ptr<GrLegacyMeshDrawOp> 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) \
Brian Salomond3ccb0a2017-04-03 10:38:00 -040025 std::unique_ptr<GrLegacyMeshDrawOp> 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 Salomond3ccb0a2017-04-03 10:38:00 -040029 friend std::unique_ptr<GrLegacyMeshDrawOp> Op##__Test(SkRandom* random, GrContext* context);
Brian Salomon5ec9def2016-12-20 15:34:05 -050030
31#endif
32#endif