Home | History | Annotate | Download | only in tests
      1 /*
      2  * Copyright 2011 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 // This is a GPU-backend specific test
     11 #if SK_SUPPORT_GPU
     12 #include "GrContextFactory.h"
     13 
     14 static void test_context_factory(skiatest::Reporter* reporter) {
     15     GrContextFactory contextFactory;
     16 
     17     // Before we ask for a context, we expect the GL context to not be there.
     18     REPORTER_ASSERT(reporter,
     19                     NULL == contextFactory.getGLContext(GrContextFactory::kNative_GLContextType));
     20 
     21     // After we ask for a context, we expect that the GL context to be there.
     22     contextFactory.get(GrContextFactory::kNative_GLContextType);
     23     REPORTER_ASSERT(reporter,
     24                     contextFactory.getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
     25 
     26     // If we did not ask for a context with the particular GL context, we would
     27     // expect the particular GL context to not be there.
     28     REPORTER_ASSERT(reporter,
     29                     NULL == contextFactory.getGLContext(GrContextFactory::kNull_GLContextType));
     30 }
     31 
     32 
     33 #include "TestClassDef.h"
     34 DEFINE_TESTCLASS("GrContextFactory", GrContextFactoryClass, test_context_factory);
     35 
     36 #endif
     37