From ce766f6c17fee9c8abfdea38ebaec48b5b7ca4d1 Mon Sep 17 00:00:00 2001 From: Neelesh-fs-dev Date: Sat, 5 Dec 2026 01:04:12 +0530 Subject: [PATCH] Add regression test for specific border color precedence A borderBottomColor should win over borderColor on the bottom edge in both LTR and RTL (see #38335). The test passes on current main, so it guards the behaviour rather than fixing a reproduced bug. --- .../react/uimanager/style/BorderColorsTest.kt | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/style/BorderColorsTest.kt 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) + } +}