Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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/SkGLContext.h" | |
| 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 a ll GPU contexts. | |
| 30 // Note: Some of the contexts might not produce a rendering output. | |
| 31 #if SK_SUPPORT_GPU | |
| 32 DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, context) { | |
| 33 REPORTER_ASSERT(reporter, reporter); | |
| 34 REPORTER_ASSERT(reporter, context); | |
| 35 } | |
| 36 #endif | |
| 37 | |
| 38 // This is an example of a GPU test that tests a property that should work for a ll GPU contexts that | |
| 39 // produce a rendering output. | |
| 40 #if SK_SUPPORT_GPU | |
| 41 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, context) { | |
| 42 REPORTER_ASSERT(reporter, reporter); | |
| 43 REPORTER_ASSERT(reporter, context); | |
| 44 } | |
| 45 #endif | |
| 46 | |
| 47 // This is an example of a GPU test that tests a property that should work at le ast for the native | |
| 48 // GPU context. If the test takes a long time to run, it may be appropriate to t est only the native | |
| 49 // context. | |
| 50 #if SK_SUPPORT_GPU | |
| 51 DEF_GPUTEST_FOR_NATIVE_CONTEXT(TestGpuNativeContext, reporter, context) { | |
| 52 REPORTER_ASSERT(reporter, reporter); | |
| 53 REPORTER_ASSERT(reporter, context); | |
| 54 } | |
| 55 #endif | |
| 56 | |
| 57 // This is an example of a GPU test that tests a property that uses the null GPU context. It should | |
| 58 // be used if the test tests some behavior that is mocked with the null context. | |
| 59 #if SK_SUPPORT_GPU | |
| 60 DEF_GPUTEST_FOR_NULL_CONTEXT(TestGpuNullContext, reporter, context) { | |
| 61 REPORTER_ASSERT(reporter, reporter); | |
| 62 REPORTER_ASSERT(reporter, context); | |
| 63 } | |
| 64 #endif | |
| 65 | |
| 66 // This is an example of a GPU test that tests a property that should work for a ll GPU contexts. | |
| 67 // It uses the additional SkGLContext* glContext to implement the test. | |
| 68 #if SK_SUPPORT_GPU | |
| 69 DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuGrContextAndGLContext, reporter, context, gl Context) { | |
|
Kimmo Kinnunen
2015/11/18 13:12:24
so would this work for the use-case you mentioned?
| |
| 70 REPORTER_ASSERT(reporter, reporter); | |
| 71 REPORTER_ASSERT(reporter, context); | |
| 72 REPORTER_ASSERT(reporter, glContext); | |
| 73 } | |
| 74 #endif | |
| 75 | |
| OLD | NEW |