ColorFinderHsv extends AbstractColorFinder { @Override protected void findColors() { LOGGER.debug("call findColors, colors : " + getColorToKeep() + getColorResult().getSubmittedCombinaisonColor().getColor() + getColorResult().getNumberOfSuggestedColors()); testedColorsFromHueRound = new HashSet<Color>(); Color colorToModify = getColorResult().getSubmittedCombinaisonColor().getColor(); testedColors = 0; changeHue(colorToModify, false); changeHue(colorToModify, true); getColorResult().setNumberOfTestedColors(testedColors); LOGGER.debug("Size of Color list : " + getColorResult().getSuggestedColors().size()); } ColorFinderHsv(); @Override String getColorFinderKey();  }
@Test public void testFindColorsGreenAlert2() { System.out.println("FindColorsGreenAlert2"); Color foregroundColor = new Color(70, 136, 71); Color backgroundColor = new Color(223, 240, 216); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(57, 111, 58); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(79, 86, 79); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(136, 70, 133); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }
@Test public void testFindColorsWithFgAndBg() { System.out.println("FindColorsWithFgAndBg"); Color foregroundColor = new Color(127, 127, 127); Color backgroundColor = new Color(128, 128, 128); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); instance.findColors(foregroundColor, backgroundColor, true, coefficientLevel); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + combinaisons.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(2, 2, 2); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(28, 10, 10); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(28, 3, 3); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }
@Test public void testFindColorsWithFgAndBg2() { System.out.println("FindColorsWithFgAndBg2"); Color foregroundColor = new Color(127, 127, 127); Color backgroundColor = new Color(128, 128, 128); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(1, 1, 1); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(27, 15, 15); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(52, 4, 4); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }
@Test public void testFindColorsBornBlack() { System.out.println("FindColorsBornBlack"); Color foregroundColor = new Color(1, 1, 1); Color backgroundColor = new Color(3, 3, 3); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, true, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } Color firstColor = new Color(133, 133, 133); assertEquals(firstColor, colorCombinaison.get(0).getColor()); }
@Test public void testFindColorsBornBlack2() { System.out.println("FindColorsBornBlack2"); Color foregroundColor = new Color(1, 1, 1); Color backgroundColor = new Color(3, 3, 3); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } Color firstColor = new Color(131, 131, 131); assertEquals(firstColor, colorCombinaison.get(0).getColor()); }
@Test public void testFindColorsBornWhite() { System.out.println("FindColorsBornWhite"); Color foregroundColor = new Color(254, 254, 254); Color backgroundColor = new Color(255, 255, 255); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, true, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(105, 105, 105); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(155, 94, 94); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(230, 1, 1); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }
@Test public void testFindColorsBornWhite2() { System.out.println("FindColorsBornWhite2"); Color foregroundColor = new Color(254, 254, 254); Color backgroundColor = new Color(255, 255, 255); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(104, 104, 104); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(154, 93, 93); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(229, 4, 4); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }
@Test public void testFindColorsGreenAlert() { System.out.println("FindColorsGreenAlert"); Color foregroundColor = new Color(70, 136, 71); Color backgroundColor = new Color(223, 240, 216); Float coefficientLevel = 4.5f; ColorFinderHsv instance = new ColorFinderHsv(); List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); instance.findColors(foregroundColor, backgroundColor, true, coefficientLevel); for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) { LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast()); colorCombinaison.add(combinaisons); } int sizeList = colorCombinaison.size(); Color firstColor = new Color(8, 15, 6); assertEquals(firstColor, colorCombinaison.get(0).getColor()); Color mediumColor = new Color(4, 15, 0); assertEquals(mediumColor, colorCombinaison.get(4).getColor()); Color endColor = new Color(0, 8, 15); assertEquals(endColor, colorCombinaison.get(sizeList - 1).getColor()); }