PaeQa implements Qa<Float, StaticColor> { @Override public TransientOperation<Float, StaticColor> evaluate(final BufferedImage left, final BufferedImage right) { CheckEqualSizePreprocessor equalSize = new CheckEqualSizePreprocessor(left, right); equalSize.process(); equalSize = null; PAEMetric metric = new PAEMetric(new SRGBColorConverter(new ConvenientBufferedImageWrapper(left)), new SRGBColorConverter(new ConvenientBufferedImageWrapper(right)), new Point(0, 0), new Point(left.getWidth(), left.getHeight())); return metric.execute(); }  @Override TransientOperation<Float, StaticColor> evaluate(final BufferedImage left, final BufferedImage right);  }
@Test(expected = PreprocessingException.class) public void evaluateTest_differentWidth() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 500, 500); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 400, 500); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); }
@Test(expected = PreprocessingException.class) public void evaluateTest_differentHeight() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 500, 400); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 500, 500); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); }
@Test public void evaluateTest_equal_solid000000() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); checkOperationEqual(op, 0.0f); }
@Test public void evaluateTest_equal_solid646464() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(100, 100, 100)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(100, 100, 100)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); checkOperationEqual(op, 0.0f); }
@Test public void evaluateTest_equal_solid9924cd() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(153, 36, 205)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(153, 36, 205)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); checkOperationEqual(op, 0.0f); }
@Test public void evaluateTest_solid0000FF_solid0099ff() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 255)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 153, 255)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); float[] expected = {0.0f, 0.6f, 0.0f}; checkOperationEqual(op, 0.6f, expected); }
@Test public void evaluateTest_half000000_111111_half000000_111111() { BufferedImage left = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255)); BufferedImage right = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); checkOperationEqual(op, 0.0f); }
@Test public void evaluateTest_half000000_000000_half000000_111111() { BufferedImage left = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(0, 0, 0)); BufferedImage right = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255)); PaeQa paeQa = new PaeQa(); TransientOperation<Float, StaticColor> op = paeQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }