Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 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 | |
| 16 | class GrDrawOp; |
| 17 | class GrContext; |
| 18 | class SkRandom; |
| 19 | |
| 20 | /** This function returns a randomly configured GrDrawOp for testing purposes. */ |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 21 | std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*); |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 22 | |
| 23 | /** GrDrawOp subclasses should define test factory functions using this macro. */ |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 24 | #define DRAW_OP_TEST_DEFINE(Op) \ |
| 25 | std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context) |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 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) \ |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 29 | friend std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context); |
Brian Salomon | 5ec9def | 2016-12-20 15:34:05 -0500 | [diff] [blame] | 30 | |
| 31 | #endif |
| 32 | #endif |