• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
12 #include "gl/GLTestContext.h"
13 #endif
14 
15 
16 // This is an example of a normal test.
DEF_TEST(TestNormal,reporter)17 DEF_TEST(TestNormal, reporter) {
18     REPORTER_ASSERT(reporter, reporter);
19 }
20 
21 // This is an example of a GPU test that uses GrContextOptions to do the test.
22 #if SK_SUPPORT_GPU
DEF_GPUTEST(TestGpuFactory,reporter,factory)23 DEF_GPUTEST(TestGpuFactory, reporter, factory) {
24     REPORTER_ASSERT(reporter, reporter);
25 }
26 #endif
27 
28 // This is an example of a GPU test that tests a property that should work for all GPU contexts.
29 // Note: Some of the contexts might not produce a rendering output.
30 #if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts,reporter,ctxInfo)31 DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) {
32     REPORTER_ASSERT(reporter, reporter);
33     REPORTER_ASSERT(reporter, ctxInfo.grContext());
34 }
35 #endif
36 
37 // This is an example of a GPU test that tests a property that should work for all GPU contexts that
38 // produce a rendering output.
39 #if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts,reporter,ctxInfo)40 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) {
41     REPORTER_ASSERT(reporter, reporter);
42     REPORTER_ASSERT(reporter, ctxInfo.grContext());
43 }
44 #endif
45 
46 // This is an example of a GPU test that tests a property that uses the null GPU context.  It should
47 // be used if the test tests some behavior that is mocked with the null context.
48 #if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext,reporter,ctxInfo)49 DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) {
50     REPORTER_ASSERT(reporter, reporter);
51     REPORTER_ASSERT(reporter, ctxInfo.grContext());
52 }
53 #endif
54