1 // Unit tests for AlphaMultiplicationEffect.
5 #include "effect_chain.h"
6 #include "gtest/gtest.h"
7 #include "image_format.h"
12 TEST(AlphaMultiplicationEffectTest, SimpleTest) {
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,
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,
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);
28 expect_equal(expected_data, out_data, 4, size);