Package net.mindengine.rainbow4j

Examples of net.mindengine.rainbow4j.ImageCompareResult


        if (spec.isCropIfOutside()) {
            elementArea = cropElementAreaIfOutside(elementArea, pageImage.getWidth(), pageImage.getHeight());
        }

        ImageCompareResult result = Rainbow4J.compare(pageImage, sampleImage, toRectangle(elementArea), sampleArea, options);

        double difference = 0.0;
        String errorMessage = null;
        if (spec.getMaxPercentage() != null) {
            difference = result.getPercentage() - spec.getMaxPercentage();
            if (difference > 0) {
                errorMessage = createErrorMessageForPercentage(msgErrorPrefix(spec.getImagePaths().get(0)), spec.getMaxPercentage(), result.getPercentage());
            }
        } else {
            if (spec.getMaxPixels() == null) {
                spec.setMaxPixels(0);
            }

            difference = result.getTotalPixels() - spec.getMaxPixels();
            if (difference > 0) {
                errorMessage = createErrorMessageForPixels(msgErrorPrefix(spec.getImagePaths().get(0)), spec.getMaxPixels(), result.getTotalPixels());
            }
        }

        return new ImageCheck(imagePath, difference, result, errorMessage);
    }
View Full Code Here

TOP

Related Classes of net.mindengine.rainbow4j.ImageCompareResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.