diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/style/BorderColorsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/style/BorderColorsTest.kt new file mode 100644 index 00000000000..03fcdccbe99 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/style/BorderColorsTest.kt @@ -0,0 +1,46 @@ +/* + * Copyright (c) Meta Platforms, Inc. and 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.style + +import android.graphics.Color +import android.util.LayoutDirection +import org.assertj.core.api.Assertions.assertThat +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment + +@RunWith(RobolectricTestRunner::class) +class BorderColorsTest { + + @Test + fun specificBottomColorOverridesBorderColorInLtr() { + val colors = BorderColors() + colors.edgeColors[LogicalEdge.ALL.ordinal] = Color.RED + colors.edgeColors[LogicalEdge.BOTTOM.ordinal] = Color.BLUE + + val resolved = colors.resolve(LayoutDirection.LTR, RuntimeEnvironment.getApplication()) + + assertThat(resolved.bottom).isEqualTo(Color.BLUE) + assertThat(resolved.left).isEqualTo(Color.RED) + assertThat(resolved.top).isEqualTo(Color.RED) + assertThat(resolved.right).isEqualTo(Color.RED) + } + + @Test + fun specificBottomColorOverridesBorderColorInRtl() { + val colors = BorderColors() + colors.edgeColors[LogicalEdge.ALL.ordinal] = Color.RED + colors.edgeColors[LogicalEdge.BOTTOM.ordinal] = Color.BLUE + + val resolved = colors.resolve(LayoutDirection.RTL, RuntimeEnvironment.getApplication()) + + assertThat(resolved.bottom).isEqualTo(Color.BLUE) + assertThat(resolved.top).isEqualTo(Color.RED) + } +}