All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.loyada.jdollarx.visual.IdentityComparator Maven / Gradle / Ivy

There is a newer version: 1.5.5
Show newest version
package com.github.loyada.jdollarx.visual;

import java.awt.image.BufferedImage;
import java.util.function.BiConsumer;

import static java.lang.String.format;

public class IdentityComparator implements BiConsumer {

    public IdentityComparator() {
    }

    @Override
    public void accept(BufferedImage refImage, BufferedImage actualImage) {
        for (int y = 0; y < actualImage.getHeight(); y++) {
            for (int x = 0; x < actualImage.getWidth(); x++) {
                if (refImage.getRGB(x, y) != actualImage.getRGB(x, y))
                    throw new AssertionError(format("found a different pixel at %d, %d",x ,y));
            }
            }
        }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy