From 61d3b08138d1820a2c9bb14764e83f6d3761207d Mon Sep 17 00:00:00 2001 From: brianosman Date: Wed, 30 Mar 2016 11:19:36 -0700 Subject: Enable gpusrgb config on bots. Don't run the config if we can't get a context with srgb support. Includes a unit test for that logic. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1846603002 Review URL: https://codereview.chromium.org/1846603002 --- tests/GrContextFactoryTest.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/GrContextFactoryTest.cpp') diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index 7dc02a56e6..800b18cce0 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -46,6 +46,29 @@ DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac } } +DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, /*factory*/) { + // Test that if sRGB support is requested, the context always has that capability + // or the context creation fails. Also test that if the creation fails, a context + // created without that flag would not have had sRGB support. + GrContextFactory testFactory; + // Test that if sRGB is requested, caps are in sync. + for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { + GrContextFactory::GLContextType glCtxType = static_cast(i); + GrContext* context = + testFactory.get(glCtxType, + GrContextFactory::kRequireSRGBSupport_GLContextOptions); + + if (context) { + REPORTER_ASSERT(reporter, context->caps()->srgbSupport()); + } else { + context = testFactory.get(glCtxType); + if (context) { + REPORTER_ASSERT(reporter, !context->caps()->srgbSupport()); + } + } + } +} + DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { GrContextFactory testFactory; for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { -- cgit v1.2.3