aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrContextFactoryTest.cpp
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-03-30 11:19:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-30 11:19:36 -0700
commit61d3b08138d1820a2c9bb14764e83f6d3761207d (patch)
tree5969dfb277fa95ca56d7d71868aeed14f67b3b0a /tests/GrContextFactoryTest.cpp
parent6f70d43719d0583d486a000f66e915c10a6b83a2 (diff)
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
Diffstat (limited to 'tests/GrContextFactoryTest.cpp')
-rw-r--r--tests/GrContextFactoryTest.cpp23
1 files changed, 23 insertions, 0 deletions
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<GrContextFactory::GLContextType>(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) {