diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK new file mode 100644 index 00000000000000..0a10da27bc1b70 --- /dev/null +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK @@ -0,0 +1,17 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "YOGA_TARGET", "react_native_dep", "react_native_target", "react_native_tests_target", "rn_robolectric_test") + +rn_robolectric_test( + name = "layoutanimation", + srcs = glob(["**/*.java"]), + contacts = ["oncall+react_native@xmail.facebook.com"], + visibility = [ + "PUBLIC", + ], + deps = [ + YOGA_TARGET, + react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/junit:junit"), + react_native_dep("third-party/java/robolectric3/robolectric:robolectric"), + react_native_target("java/com/facebook/react/uimanager:uimanager"), + ], +) diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java new file mode 100644 index 00000000000000..b28fad7bb3ff92 --- /dev/null +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.uimanager.layoutanimation; + +import com.facebook.react.uimanager.layoutanimation.InterpolatorType; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import static org.fest.assertions.api.Assertions.assertThat; + +@RunWith(RobolectricTestRunner.class) +public class InterpolatorTypeTest { + + @Test + public void testCamelCase() { + assertThat(InterpolatorType.fromString("linear")).isEqualTo(InterpolatorType.LINEAR); + assertThat(InterpolatorType.fromString("easeIn")).isEqualTo(InterpolatorType.EASE_IN); + assertThat(InterpolatorType.fromString("easeOut")).isEqualTo(InterpolatorType.EASE_OUT); + assertThat(InterpolatorType.fromString("easeInEaseOut")).isEqualTo(InterpolatorType.EASE_IN_EASE_OUT); + assertThat(InterpolatorType.fromString("spring")).isEqualTo(InterpolatorType.SPRING); + } + + @Test + public void testOtherCases() { + assertThat(InterpolatorType.fromString("EASEIN")).isEqualTo(InterpolatorType.EASE_IN); + assertThat(InterpolatorType.fromString("easeout")).isEqualTo(InterpolatorType.EASE_OUT); + assertThat(InterpolatorType.fromString("easeineaseout")).isEqualTo(InterpolatorType.EASE_IN_EASE_OUT); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidInterpolatorTypes() throws IllegalArgumentException { + InterpolatorType.fromString("ease_in_ease_out"); + } +}