Testing Gamma Color Evaluation Mechanics in lottie-android
This test suite validates the GammaEvaluator utility class in the Lottie Android animation library, focusing on color interpolation functionality. The tests ensure accurate gamma correction calculations when evaluating color transitions, particularly for identical color values.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
airbnb/lottie-android
lottie/src/test/java/com/airbnb/lottie/utils/GammaEvaluatorTest.java
package com.airbnb.lottie.utils;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
public class GammaEvaluatorTest {
@Test
public void testEvaluateForSameColorValues() {
for (int color = 0x000000; color <= 0xffffff; color++) {
int actual = GammaEvaluator.evaluate(0.3f, color, color);
assertThat(actual, is(color));
}
}
}