LayoutComparator implements ComparatorJob { boolean hasMaskThresholdWithAcceptableDifference(ImageComparisonResult mask) { if (pixelThreshold != null && percentageThreshold != null) { return isAcceptablePixelChange(mask) && this.isAcceptablePercentageChange(mask); } else if (pixelThreshold != null) { return isAcceptablePixelChange(mask); } else if (percentageThreshold != null) { return isAcceptablePercentageChange(mask); } return false; } LayoutComparator(ComparatorProperties comparatorProperties, ArtifactsDAO artifactsDAO); @Override ComparatorStepResult compare(); void setPixelThreshold(Integer pixelThreshold); void setPercentageThreshold(Double percentageThreshold); void setFuzz(int fuzz); @Override void setParameters(Map<String, String> params); static final String COMPARATOR_TYPE; static final String COMPARATOR_NAME; static final String CONTENT_TYPE; static final String PERCENTAGE_THRESHOLD_PARAM; static final String PIXEL_THRESHOLD_PARAM; static final String FUZZ_PARAM; }
@Test public void hasMaskThresholdWithAcceptableDifference_withoutThreshold_expectFalse() { when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); assertThat( this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), is(false)); }