From a18a8bca24f8b927c360e36f23d2fd08c6378805 Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Thu, 3 Dec 2015 23:04:50 -0800 Subject: 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 --- tests/GrContextFactoryTest.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'tests/GrContextFactoryTest.cpp') 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 -- cgit v1.2.3