X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain_test.cpp;h=adf832ac61e4ad445f115a72b83f324352f78812;hp=a8cb41f044d1fa9b6070fb32b676abc3f373a195;hb=9c6b86affb570a2e2d18c6da795c359da393f9a3;hpb=d47ac1e362683896033f43ecd9aeb2f2330b5678 diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index a8cb41f..adf832a 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -1305,10 +1305,7 @@ TEST(EffectChainTest, StringStreamLocalesWork) { TEST(EffectChainTest, sRGBIntermediate) { float data[] = { - 0.0f, 0.25f, 0.0f, 1.0f, - }; - float expected_data[] = { - 0.0f, 0.25048828125f, 0.0f, 1.0f, + 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); @@ -1316,7 +1313,10 @@ TEST(EffectChainTest, sRGBIntermediate) { tester.get_chain()->add_effect(new BouncingIdentityEffect()); tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR); - expect_equal(expected_data, out_data, 4, 1, 1e-4); + 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