2012-08-14 22:02:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Test.h"
|
|
|
|
|
|
|
|
// This is a GPU-backend specific test
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
#include "GrContextFactory.h"
|
|
|
|
|
2013-04-19 13:24:28 +00:00
|
|
|
static void test_context_factory(skiatest::Reporter* reporter,
|
|
|
|
GrContextFactory* contextFactory) {
|
|
|
|
// Reset in case some other test has been using it first.
|
|
|
|
contextFactory->destroyContexts();
|
2012-08-14 22:02:48 +00:00
|
|
|
|
|
|
|
// Before we ask for a context, we expect the GL context to not be there.
|
|
|
|
REPORTER_ASSERT(reporter,
|
2013-04-19 13:24:28 +00:00
|
|
|
NULL == contextFactory->getGLContext(GrContextFactory::kNative_GLContextType));
|
2012-08-14 22:02:48 +00:00
|
|
|
|
|
|
|
// After we ask for a context, we expect that the GL context to be there.
|
2013-04-19 13:24:28 +00:00
|
|
|
contextFactory->get(GrContextFactory::kNative_GLContextType);
|
2012-08-14 22:02:48 +00:00
|
|
|
REPORTER_ASSERT(reporter,
|
2013-04-19 13:24:28 +00:00
|
|
|
contextFactory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
|
2012-08-14 22:02:48 +00:00
|
|
|
|
|
|
|
// If we did not ask for a context with the particular GL context, we would
|
|
|
|
// expect the particular GL context to not be there.
|
|
|
|
REPORTER_ASSERT(reporter,
|
2013-04-19 13:24:28 +00:00
|
|
|
NULL == contextFactory->getGLContext(GrContextFactory::kNull_GLContextType));
|
2012-08-14 22:02:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "TestClassDef.h"
|
2013-04-19 13:24:28 +00:00
|
|
|
DEFINE_GPUTESTCLASS("GrContextFactory", GrContextFactoryClass, test_context_factory);
|
2012-08-14 22:02:48 +00:00
|
|
|
|
|
|
|
#endif
|