-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Adding a test for the newly added InterpolatorType.fromString() Reviewed By: axe-fb Differential Revision: D10203814 fbshipit-source-id: f3c70db1a5754c79b1bdd881d266bec110934494
- Loading branch information
1 parent
31d6a69
commit b7526b2
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK
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,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"), | ||
], | ||
) |
39 changes: 39 additions & 0 deletions
39
...roid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.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,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"); | ||
} | ||
} |