| Index: tests/GrContextFactoryTest.cpp
|
| diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
|
| index 7dc02a56e6b25e24035bebf5b185d529b013faa1..800b18cce0b8d29f59f2be9562b63ccd973fe09a 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) {
|
|
|