+
+// An effect that does nothing, but requests texture bounce.
+class BouncingIdentityEffect : public Effect {
+public:
+ BouncingIdentityEffect() {}
+ virtual std::string effect_type_id() const { return "IdentityEffect"; }
+ std::string output_fragment_shader() { return read_file("identity.frag"); }
+ bool needs_texture_bounce() const { return true; }
+};
+
+TEST(EffectChainTest, TextureBouncePreservesIdentity) {
+ float data[] = {
+ 0.0f, 0.25f, 0.3f,
+ 0.75f, 1.0f, 1.0f,
+ };
+ float out_data[6];
+ EffectChainTester tester(data, 3, 2, COLORSPACE_sRGB, GAMMA_LINEAR);
+ tester.get_chain()->add_effect(new BouncingIdentityEffect());
+ tester.run(out_data, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ expect_equal(data, out_data, 3, 2);
+}
+
+TEST(MirrorTest, BasicTest) {
+ float data[] = {
+ 0.0f, 0.25f, 0.3f,
+ 0.75f, 1.0f, 1.0f,
+ };
+ float expected_data[6] = {
+ 0.3f, 0.25f, 0.0f,
+ 1.0f, 1.0f, 0.75f,
+ };
+ float out_data[6];
+ EffectChainTester tester(data, 3, 2, COLORSPACE_sRGB, GAMMA_LINEAR);
+ tester.get_chain()->add_effect(new MirrorEffect());
+ tester.run(out_data, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ expect_equal(expected_data, out_data, 3, 2);
+}