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