]> git.sesse.net Git - movit/blob - alpha_multiplication_effect_test.cpp
Add a notice to render_to_screen() that it might be suboptimal.
[movit] / alpha_multiplication_effect_test.cpp
1 // Unit tests for AlphaMultiplicationEffect.
2
3 #include <epoxy/gl.h>
4
5 #include "effect_chain.h"
6 #include "gtest/gtest.h"
7 #include "image_format.h"
8 #include "test_util.h"
9
10 namespace movit {
11
12 TEST(AlphaMultiplicationEffectTest, SimpleTest) {
13         const int size = 3;
14         float data[4 * size] = {
15                 1.0f, 0.2f, 0.2f, 0.0f,
16                 0.2f, 1.0f, 0.2f, 0.5f,
17                 0.2f, 0.2f, 1.0f, 1.0f,
18         };
19         float expected_data[4 * size] = {
20                 0.0f, 0.0f, 0.0f, 0.0f,
21                 0.1f, 0.5f, 0.1f, 0.5f,
22                 0.2f, 0.2f, 1.0f, 1.0f,
23         };
24         float out_data[4 * size];
25         EffectChainTester tester(data, 1, size, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_LINEAR);
26         tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
27
28         expect_equal(expected_data, out_data, 4, size);
29 }
30
31 }  // namespace movit