aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrContextFactoryTest.cpp
diff options
context:
space:
mode:
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) {