kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [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 | #include "Test.h" |
| 9 | |
| 10 | #if SK_SUPPORT_GPU |
| 11 | #include "GrContext.h" |
bsalomon | 273c0f5 | 2016-03-31 10:59:06 -0700 | [diff] [blame] | 12 | #include "gl/GLTestContext.h" |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 13 | #endif |
| 14 | |
| 15 | |
| 16 | // This is an example of a normal test. |
| 17 | DEF_TEST(TestNormal, reporter) { |
| 18 | REPORTER_ASSERT(reporter, reporter); |
| 19 | } |
| 20 | |
| 21 | // This is an example of a GPU test that uses common GrContextFactory factory to do the test. |
| 22 | #if SK_SUPPORT_GPU |
| 23 | DEF_GPUTEST(TestGpuFactory, reporter, factory) { |
| 24 | REPORTER_ASSERT(reporter, reporter); |
| 25 | REPORTER_ASSERT(reporter, factory); |
| 26 | } |
| 27 | #endif |
| 28 | |
| 29 | // This is an example of a GPU test that tests a property that should work for all GPU contexts. |
| 30 | // Note: Some of the contexts might not produce a rendering output. |
| 31 | #if SK_SUPPORT_GPU |
bsalomon | 758586c | 2016-04-06 14:02:39 -0700 | [diff] [blame] | 32 | DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 33 | REPORTER_ASSERT(reporter, reporter); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 34 | REPORTER_ASSERT(reporter, ctxInfo.grContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 35 | } |
| 36 | #endif |
| 37 | |
| 38 | // This is an example of a GPU test that tests a property that should work for all GPU contexts that |
| 39 | // produce a rendering output. |
| 40 | #if SK_SUPPORT_GPU |
bsalomon | 68d9134 | 2016-04-12 09:59:58 -0700 | [diff] [blame] | 41 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 42 | REPORTER_ASSERT(reporter, reporter); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 43 | REPORTER_ASSERT(reporter, ctxInfo.grContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 44 | } |
| 45 | #endif |
| 46 | |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 47 | // This is an example of a GPU test that tests a property that uses the null GPU context. It should |
| 48 | // be used if the test tests some behavior that is mocked with the null context. |
| 49 | #if SK_SUPPORT_GPU |
bsalomon | 758586c | 2016-04-06 14:02:39 -0700 | [diff] [blame] | 50 | DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 51 | REPORTER_ASSERT(reporter, reporter); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 52 | REPORTER_ASSERT(reporter, ctxInfo.grContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 53 | } |
| 54 | #endif |