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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "tests/Test.h" |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 9 | |
Robert Phillips | 0c5bb2f | 2020-07-17 15:40:13 -0400 | [diff] [blame] | 10 | #include "include/gpu/GrDirectContext.h" |
Robert Phillips | 08ba085 | 2019-05-22 20:23:43 +0000 | [diff] [blame] | 11 | #include "tools/gpu/gl/GLTestContext.h" |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 12 | |
| 13 | // This is an example of a normal test. |
| 14 | DEF_TEST(TestNormal, reporter) { |
| 15 | REPORTER_ASSERT(reporter, reporter); |
| 16 | } |
| 17 | |
Brian Salomon | dcfca43 | 2017-11-15 15:48:03 -0500 | [diff] [blame] | 18 | // This is an example of a GPU test that uses GrContextOptions to do the test. |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 19 | DEF_GPUTEST(TestGpuFactory, reporter, factory) { |
| 20 | REPORTER_ASSERT(reporter, reporter); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 21 | } |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 22 | |
| 23 | // This is an example of a GPU test that tests a property that should work for all GPU contexts. |
| 24 | // Note: Some of the contexts might not produce a rendering output. |
egdaniel | ab527a5 | 2016-06-28 08:07:26 -0700 | [diff] [blame] | 25 | DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 26 | REPORTER_ASSERT(reporter, reporter); |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 27 | REPORTER_ASSERT(reporter, ctxInfo.directContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 28 | } |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 29 | |
| 30 | // This is an example of a GPU test that tests a property that should work for all GPU contexts that |
| 31 | // produce a rendering output. |
bsalomon | 68d9134 | 2016-04-12 09:59:58 -0700 | [diff] [blame] | 32 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 33 | REPORTER_ASSERT(reporter, reporter); |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 34 | REPORTER_ASSERT(reporter, ctxInfo.directContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 35 | } |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 36 | |
Brian Osman | fbe2406 | 2019-04-03 16:04:45 +0000 | [diff] [blame] | 37 | // This is an example of a GPU test that tests a property that uses the mock context. It should |
| 38 | // be used if the test tests some behavior that is mocked with the mock context. |
| 39 | DEF_GPUTEST_FOR_MOCK_CONTEXT(TestMockContext, reporter, ctxInfo) { |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 40 | REPORTER_ASSERT(reporter, reporter); |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 41 | REPORTER_ASSERT(reporter, ctxInfo.directContext()); |
kkinnunen | 179a8f5 | 2015-11-20 13:32:24 -0800 | [diff] [blame] | 42 | } |