X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain_test.cpp;h=50d004db1c52c1192946b87add1b785149f585fc;hp=f50d2ead3685db68703d7df412a9e2cb7cf3361b;hb=refs%2Fheads%2Fepoxy;hpb=ab89030be6f55cd1955b9e033c62c2e3c3ba2a2f diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index f50d2ea..50d004d 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -152,19 +152,23 @@ TEST(EffectChainTest, RewritingWorksAndGammaConversionsAreInserted) { TEST(EffectChainTest, RewritingWorksAndTexturesAreAskedForsRGB) { unsigned char data[] = { - 0, 64, - 128, 255, + 0, 0, 0, 255, + 64, 64, 64, 255, + 128, 128, 128, 255, + 255, 255, 255, 255, }; - float expected_data[4] = { - 1.0f, 0.9771f, - 0.8983f, 0.0f, + float expected_data[] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 0.9771f, 0.9771f, 0.9771f, 1.0000f, + 0.8983f, 0.8983f, 0.8983f, 1.0000f, + 0.0000f, 0.0000f, 0.0000f, 1.0000f }; - float out_data[4]; - EffectChainTester tester(NULL, 2, 2); - tester.add_input(data, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_sRGB); + float out_data[4 * 4]; + EffectChainTester tester(NULL, 1, 4); + tester.add_input(data, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB); RewritingEffect *effect = new RewritingEffect(); tester.get_chain()->add_effect(effect); - tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_sRGB); + tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_sRGB); Node *node = effect->replaced_node; ASSERT_EQ(1, node->incoming_links.size()); @@ -172,7 +176,7 @@ TEST(EffectChainTest, RewritingWorksAndTexturesAreAskedForsRGB) { EXPECT_EQ("FlatInput", node->incoming_links[0]->effect->effect_type_id()); EXPECT_EQ("GammaCompressionEffect", node->outgoing_links[0]->effect->effect_type_id()); - expect_equal(expected_data, out_data, 2, 2); + expect_equal(expected_data, out_data, 4, 4); } TEST(EffectChainTest, RewritingWorksAndColorspaceConversionsAreInserted) { @@ -223,7 +227,7 @@ private: GammaCurve overridden_gamma_curve; }; -TEST(EffectChainTester, HandlesInputChangingColorspace) { +TEST(EffectChainTest, HandlesInputChangingColorspace) { const int size = 4; float data[size] = { @@ -983,7 +987,7 @@ TEST(EffectChainTest, IdentityWithOwnPool) { 0.75f, 1.0f, 1.0f, 0.0f, 0.25f, 0.3f, }; - float out_data[6]; + float out_data[6], temp[6 * 4]; EffectChain chain(width, height); movit_debug_level = MOVIT_DEBUG_ON; @@ -1025,8 +1029,11 @@ TEST(EffectChainTest, IdentityWithOwnPool) { glBindFramebuffer(GL_FRAMEBUFFER, fbo); check_error(); - glReadPixels(0, 0, width, height, GL_RED, GL_FLOAT, out_data); + glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, temp); check_error(); + for (unsigned i = 0; i < 6; ++i) { + out_data[i] = temp[i * 4]; + } expect_equal(expected_data, out_data, width, height);