]> git.sesse.net Git - movit/blobdiff - gamma_expansion_effect_test.cpp
Run include-what-you-use over all of movit. Some hand tuning.
[movit] / gamma_expansion_effect_test.cpp
index ed124c4f31c7a9d750c91bcf4269e4398fd7839c..6fc0252c8c5a28780e7d6127790a0e942543a9f5 100644 (file)
@@ -1,8 +1,10 @@
 // Unit tests for GammaExpansionEffect.
 
-#include "test_util.h"
-#include "gtest/gtest.h"
+#include <GL/glew.h>
+
 #include "gamma_expansion_effect.h"
+#include "gtest/gtest.h"
+#include "test_util.h"
 
 TEST(GammaExpansionEffectTest, sRGB_KeyValues) {
        float data[] = {
@@ -34,6 +36,21 @@ TEST(GammaExpansionEffectTest, sRGB_RampAlwaysIncreases) {
        }
 }
 
+TEST(GammaExpansionEffectTest, sRGB_AlphaIsUnchanged) {
+       float data[] = {
+               0.0f, 0.0f, 0.0f, 0.0f,
+               0.0f, 0.0f, 0.0f, 0.25f,
+               0.0f, 0.0f, 0.0f, 0.5f,
+               0.0f, 0.0f, 0.0f, 0.75f,
+               0.0f, 0.0f, 0.0f, 1.0f,
+       };
+       float out_data[5 * 4];
+       EffectChainTester tester(data, 5, 1, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_sRGB);
+       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+       expect_equal(data, out_data, 5, 1);
+}
+
 TEST(GammaExpansionEffectTest, Rec709_KeyValues) {
        float data[] = {
                0.0f, 1.0f,
@@ -63,3 +80,18 @@ TEST(GammaExpansionEffectTest, Rec709_RampAlwaysIncreases) {
                   << "No increase between " << i-1 << " and " << i;
        }
 }
+
+TEST(GammaExpansionEffectTest, Rec709_AlphaIsUnchanged) {
+       float data[] = {
+               0.0f, 0.0f, 0.0f, 0.0f,
+               0.0f, 0.0f, 0.0f, 0.25f,
+               0.0f, 0.0f, 0.0f, 0.5f,
+               0.0f, 0.0f, 0.0f, 0.75f,
+               0.0f, 0.0f, 0.0f, 1.0f,
+       };
+       float out_data[5 * 4];
+       EffectChainTester tester(data, 5, 1, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_REC_709);
+       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+       expect_equal(data, out_data, 5, 1);
+}