X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=effect_chain_test.cpp;h=adf832ac61e4ad445f115a72b83f324352f78812;hb=274627c966f53780991e9f80887aa1906b592751;hp=6ab874d2e4e32507beb5cc9eeb546fac69e9f546;hpb=54d47f65e9abac77229636fbaaefea8caf34a4d4;p=movit diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index 6ab874d..adf832a 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -1303,5 +1303,20 @@ TEST(EffectChainTest, StringStreamLocalesWork) { free(saved_locale); } +TEST(EffectChainTest, sRGBIntermediate) { + float data[] = { + 0.0f, 0.5f, 0.0f, 1.0f, + }; + float out_data[4]; + EffectChainTester tester(data, 1, 1, FORMAT_RGBA_PREMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA16F_ARB, GL_SRGB8); + tester.get_chain()->add_effect(new IdentityEffect()); + tester.get_chain()->add_effect(new BouncingIdentityEffect()); + tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR); + + EXPECT_GE(fabs(out_data[1] - data[1]), 1e-3) + << "Expected sRGB not to be able to represent 0.5 exactly (got " << out_data[1] << ")"; + EXPECT_LT(fabs(out_data[1] - data[1]), 0.1f) + << "Expected sRGB to be able to represent 0.5 approximately (got " << out_data[1] << ")"; +} } // namespace movit