skia2/tests/GrContextFactoryTest.cpp
kkinnunen a18a8bca24 Skip dm GPU configs when context creation fails
Skip dm GPU configs when context creation fails instead of stopping
the whole dm run.

Review URL: https://codereview.chromium.org/1497713002
2015-12-03 23:04:50 -08:00

47 lines
1.4 KiB
C++

/*
* 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 "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#include "GrCaps.h"
#include "Test.h"
DEF_GPUTEST(GrContextFactory_NVPRContextTypeHasPathRenderingSupport, reporter, /*factory*/) {
// Test that if NVPR is requested, the context always has path rendering
// or the context creation fails.
GrContextFactory testFactory;
GrContext* context = testFactory.get(GrContextFactory::kNVPR_GLContextType);
if (context) {
REPORTER_ASSERT(
reporter,
context->caps()->shaderCaps()->pathRenderingSupport());
}
}
DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*factory*/) {
// Test that if NVPR is not requested, the context never has path rendering support.
GrContextFactory testFactory;
for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
if (glCtxType == GrContextFactory::kNVPR_GLContextType) {
continue;
}
GrContext* context = testFactory.get(glCtxType);
if (context) {
REPORTER_ASSERT(
reporter,
!context->caps()->shaderCaps()->pathRenderingSupport());
}
}
}
#endif