aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-12-03 23:04:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-03 23:04:50 -0800
commita18a8bca24f8b927c360e36f23d2fd08c6378805 (patch)
tree5651beb3fe23c8c0c9d26fa123400d66b27da0bf /tests
parent6dea83f244cfdea52901eef6b31cee60b07a8ea0 (diff)
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
Diffstat (limited to 'tests')
-rwxr-xr-xtests/GLInterfaceValidationTest.cpp39
-rw-r--r--tests/GrContextFactoryTest.cpp31
2 files changed, 30 insertions, 40 deletions
diff --git a/tests/GLInterfaceValidationTest.cpp b/tests/GLInterfaceValidationTest.cpp
deleted file mode 100755
index 5736e2d2d6..0000000000
--- a/tests/GLInterfaceValidationTest.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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"
-
-DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
- for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
- GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
- // this forces the factory to make the context if it hasn't yet
- GrContextFactory::ContextInfo* contextInfo = factory->getContextInfo(glCtxType);
- SkGLContext* glCtx = contextInfo ? contextInfo->fGLContext : nullptr;
-
- // We're supposed to fail the NVPR context type when we the native context that does not
- // support the NVPR extension.
- if (GrContextFactory::kNVPR_GLContextType == glCtxType &&
- factory->getContextInfo(GrContextFactory::kNative_GLContextType) &&
- !factory->getContextInfo(GrContextFactory::kNative_GLContextType)->fGLContext->gl()->hasExtension("GL_NV_path_rendering")) {
- REPORTER_ASSERT(reporter, nullptr == glCtx);
- continue;
- }
-
- REPORTER_ASSERT(reporter, glCtx);
- if (glCtx) {
- const GrGLInterface* interface = glCtx->gl();
- REPORTER_ASSERT(reporter, interface->validate());
- }
- }
-}
-
-#endif
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index 79209c719f..176391ef8d 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -10,8 +10,37 @@
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
+#include "GrCaps.h"
#include "Test.h"
-// TODO: test GrContextFactory.
+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