Closed Starlight220 closed 1 year ago
Also, we need to make sure the new Color.fromHSV algorithm works as intended too.
I can independently verify the algorithm itself works - on top is previous algorithm, on bottom is current algorithm; however, I did have to tweak the formula a little (changes which are reflected in #4724) because the existing algorithm relies on clamping to force values into [0,255].
This fails:
The issue is likely that
AddressableLEDBuffer.setHSV()
wasn't updated to use the newColor.fromHSV()
impl from #4439.Full code for the above test:
```diff diff --git a/wpilibj/src/test/java/edu/wpi/first/wpilibj/AddressableLEDBufferTest.java b/wpilibj/src/test/java/edu/wpi/first/wpilibj/AddressableLEDBufferTest.java index 6f00ba83a..5b662120e 100644 --- a/wpilibj/src/test/java/edu/wpi/first/wpilibj/AddressableLEDBufferTest.java +++ b/wpilibj/src/test/java/edu/wpi/first/wpilibj/AddressableLEDBufferTest.java @@ -10,11 +10,14 @@ import static org.junit.jupiter.params.provider.Arguments.arguments; import edu.wpi.first.wpilibj.util.Color; import edu.wpi.first.wpilibj.util.Color8Bit; + +import java.util.Random; import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; class AddressableLEDBufferTest { @ParameterizedTest @@ -70,4 +73,26 @@ class AddressableLEDBufferTest { assertEquals(firstRedColor8Bit, buffer.getLED8Bit(2)); assertEquals(firstBlueColor8Bit, buffer.getLED8Bit(3)); } + + static Stream