]> git.sesse.net Git - movit/blobdiff - dither_effect_test.cpp
Redo FBO association yet again, this time per-texture.
[movit] / dither_effect_test.cpp
index 81f6a2402d6d677e25c2e22727308ead45c491fd..18b286ed3e3210c4fa0c0546b1739f5df4759baf 100644 (file)
@@ -1,9 +1,15 @@
 // Unit tests for DitherEffect.
 
+#include <GL/glew.h>
 #include <math.h>
 
-#include "test_util.h"
+#include "effect_chain.h"
 #include "gtest/gtest.h"
+#include "image_format.h"
+#include "test_util.h"
+#include "util.h"
+
+namespace movit {
 
 TEST(DitherEffectTest, NoDitherOnExactValues) {
        const int size = 4;
@@ -23,8 +29,11 @@ TEST(DitherEffectTest, NoDitherOnExactValues) {
        unsigned char out_data[size * size];
 
        EffectChainTester tester(data, size, size, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA8);
+       check_error();
        tester.get_chain()->set_dither_bits(8);
+       check_error();
        tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR);
+       check_error();
 
        expect_equal(expected_data, out_data, size, size);
 }
@@ -50,5 +59,7 @@ TEST(DitherEffectTest, SinusoidBelowOneLevelComesThrough) {
                sum += 2.0 * (int(out_data[i]) - 0.2*255.0) * sin(i * frequency);
        }
 
-       EXPECT_NEAR(amplitude, sum / (size * 255.0f), 1e-5);
+       EXPECT_NEAR(amplitude, sum / (size * 255.0f), 1.1e-5);
 }
+
+}  // namespace movit