]> git.sesse.net Git - movit/blob - alpha_multiplication_effect_test.cpp
Put the resample alpha handling on the right effect.
[movit] / alpha_multiplication_effect_test.cpp
1 // Unit tests for AlphaMultiplicationEffect.
2
3 #include <GL/glew.h>
4
5 #include "effect_chain.h"
6 #include "gtest/gtest.h"
7 #include "image_format.h"
8 #include "test_util.h"
9
10 TEST(AlphaMultiplicationEffectTest, SimpleTest) {
11         const int size = 3;
12         float data[4 * size] = {
13                 1.0f, 0.2f, 0.2f, 0.0f,
14                 0.2f, 1.0f, 0.2f, 0.5f,
15                 0.2f, 0.2f, 1.0f, 1.0f,
16         };
17         float expected_data[4 * size] = {
18                 0.0f, 0.0f, 0.0f, 0.0f,
19                 0.1f, 0.5f, 0.1f, 0.5f,
20                 0.2f, 0.2f, 1.0f, 1.0f,
21         };
22         float out_data[4 * size];
23         EffectChainTester tester(data, 1, size, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_LINEAR);
24         tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
25
26         expect_equal(expected_data, out_data, 4, size);
27 }