Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lottie/src/test/java/com/airbnb/lottie/parser/GradientColorParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.airbnb.lottie.parser; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class GradientColorParserTest { | ||
|
||
@Test public void testNoDistinctShort() { | ||
assertMerged(new float[]{1}, new float[]{2}, new float[]{1, 2}); | ||
} | ||
|
||
@Test public void testNoDistinct() { | ||
assertMerged(new float[]{1, 2, 3}, new float[]{4, 5, 6}, new float[]{1, 2, 3, 4, 5, 6}); | ||
} | ||
|
||
@Test public void testWithDistinct() { | ||
assertMerged(new float[]{1, 2, 3, 5}, new float[]{4, 5, 6}, new float[]{1, 2, 3, 4, 5, 6}); | ||
} | ||
|
||
@Test public void testWithDistinctInterleavingValues() { | ||
assertMerged(new float[]{2, 4, 5, 6, 8, 10}, new float[]{1, 3, 4, 5, 7, 9}, new float[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); | ||
} | ||
|
||
@Test public void testIdentical() { | ||
assertMerged(new float[]{2, 3}, new float[]{2, 3}, new float[]{2, 3}); | ||
} | ||
|
||
private void assertMerged(float[] arrayA, float[] arrayB, float[] merged) { | ||
assertArrayEquals(merged, GradientColorParser.mergeUniqueElements(arrayA, arrayB), 0f); | ||
} | ||
} |