OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
| 8 #if SK_SUPPORT_GPU |
| 9 |
| 10 #include "GrContextFactory.h" |
8 #include "Test.h" | 11 #include "Test.h" |
| 12 #include "TestClassDef.h" |
9 | 13 |
10 // This is a GPU-backend specific test | 14 DEF_GPUTEST(GrContextFactoryTest, reporter, factory) { |
11 #if SK_SUPPORT_GPU | |
12 #include "GrContextFactory.h" | |
13 | |
14 static void test_context_factory(skiatest::Reporter* reporter, | |
15 GrContextFactory* contextFactory) { | |
16 // Reset in case some other test has been using it first. | 15 // Reset in case some other test has been using it first. |
17 contextFactory->destroyContexts(); | 16 factory->destroyContexts(); |
18 | 17 |
19 // Before we ask for a context, we expect the GL context to not be there. | 18 // Before we ask for a context, we expect the GL context to not be there. |
20 REPORTER_ASSERT(reporter, | 19 REPORTER_ASSERT(reporter, |
21 NULL == contextFactory->getGLContext(GrContextFactory::kNati
ve_GLContextType)); | 20 NULL == factory->getGLContext(GrContextFactory::kNative_GLCo
ntextType)); |
22 | 21 |
23 // After we ask for a context, we expect that the GL context to be there. | 22 // After we ask for a context, we expect that the GL context to be there. |
24 contextFactory->get(GrContextFactory::kNative_GLContextType); | 23 factory->get(GrContextFactory::kNative_GLContextType); |
25 REPORTER_ASSERT(reporter, | 24 REPORTER_ASSERT(reporter, |
26 contextFactory->getGLContext(GrContextFactory::kNative_GLCon
textType) != NULL); | 25 factory->getGLContext(GrContextFactory::kNative_GLContextTyp
e) != NULL); |
27 | 26 |
28 // If we did not ask for a context with the particular GL context, we would | 27 // If we did not ask for a context with the particular GL context, we would |
29 // expect the particular GL context to not be there. | 28 // expect the particular GL context to not be there. |
30 REPORTER_ASSERT(reporter, | 29 REPORTER_ASSERT(reporter, |
31 NULL == contextFactory->getGLContext(GrContextFactory::kNull
_GLContextType)); | 30 NULL == factory->getGLContext(GrContextFactory::kNull_GLCont
extType)); |
32 } | 31 } |
33 | 32 |
34 | |
35 #include "TestClassDef.h" | |
36 DEFINE_GPUTESTCLASS("GrContextFactory", GrContextFactoryClass, test_context_fact
ory); | |
37 | |
38 #endif | 33 #endif |
OLD | NEW |