Skip to content

Commit

Permalink
Added ctesque integration tests for Color#HSVToColor.
Browse files Browse the repository at this point in the history
Tests added to check the pinning of saturation and value parameters in Color#HSVToColor.
  • Loading branch information
mlebedy committed Jun 8, 2023
1 parent fef1dce commit 885028b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 89 deletions.
@@ -0,0 +1,25 @@
package android.graphics;

import static com.google.common.truth.Truth.assertThat;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.internal.DoNotInstrument;

/** Compatibility tests for {@link Color} */
@DoNotInstrument
@RunWith(AndroidJUnit4.class)
public class ColorTest {
@Test
public void HSVToColorValueShouldBePinned() {
assertThat(Color.HSVToColor(new float[] {0f, 0f, -1.0f})).isEqualTo(Color.BLACK);
assertThat(Color.HSVToColor(new float[] {0f, 0f, 2.0f})).isEqualTo(Color.WHITE);
}

@Test
public void HSVToColorSaturationShouldBePinned() {
assertThat(Color.HSVToColor(new float[] {0f, -1.0f, 0.5f})).isEqualTo(0xff808080);
assertThat(Color.HSVToColor(new float[] {0f, 2.0f, 0.5f})).isEqualTo(0xff800000);
}
}

This file was deleted.

0 comments on commit 885028b

Please sign in to comment.