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 #include "GrContext.h"
11 #include "gl/GLTestContext.h"
12
13 // This is an example of a normal test.
DEF_TEST(TestNormal,reporter)14 DEF_TEST(TestNormal, reporter) {
15 REPORTER_ASSERT(reporter, reporter);
16 }
17
18 // This is an example of a GPU test that uses GrContextOptions to do the test.
DEF_GPUTEST(TestGpuFactory,reporter,factory)19 DEF_GPUTEST(TestGpuFactory, reporter, factory) {
20 REPORTER_ASSERT(reporter, reporter);
21 }
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.
DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts,reporter,ctxInfo)25 DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) {
26 REPORTER_ASSERT(reporter, reporter);
27 REPORTER_ASSERT(reporter, ctxInfo.grContext());
28 }
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.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts,reporter,ctxInfo)32 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) {
33 REPORTER_ASSERT(reporter, reporter);
34 REPORTER_ASSERT(reporter, ctxInfo.grContext());
35 }
36
37 // This is an example of a GPU test that tests a property that uses the null GPU context. It should
38 // be used if the test tests some behavior that is mocked with the null context.
DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext,reporter,ctxInfo)39 DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) {
40 REPORTER_ASSERT(reporter, reporter);
41 REPORTER_ASSERT(reporter, ctxInfo.grContext());
42 }
43