Search in sources :

Example 1 with ImageDiff

use of ru.yandex.qatools.ashot.comparison.ImageDiff in project ashot by yandex-qatools.

the class DifferTest method testCoordsToCompareAndIgnoredCombine.

@Test
public void testCoordsToCompareAndIgnoredCombine() throws Exception {
    Screenshot a = createScreenshotWithIgnoredAreas(IMAGE_A_SMALL, new HashSet<>(asList(new Coords(60, 60))));
    a.setCoordsToCompare(new HashSet<>(asList(new Coords(50, 50, 100, 100))));
    Screenshot b = createScreenshotWithIgnoredAreas(IMAGE_B_SMALL, new HashSet<>(asList(new Coords(80, 80))));
    b.setCoordsToCompare(new HashSet<>(asList(new Coords(50, 50, 100, 100))));
    ImageDiff diff = imageDiffer.makeDiff(a, b);
    assertThat(diff.getMarkedImage(), ImageTool.equalImage(loadImage("img/expected/combined_diff.png")));
}
Also used : ImageDiff(ru.yandex.qatools.ashot.comparison.ImageDiff) Screenshot(ru.yandex.qatools.ashot.Screenshot) Coords(ru.yandex.qatools.ashot.coordinates.Coords) Test(org.junit.Test)

Example 2 with ImageDiff

use of ru.yandex.qatools.ashot.comparison.ImageDiff in project ashot by yandex-qatools.

the class DifferTest method testEqualImagesWithWrongIgnoredColorDiff.

@Test
public void testEqualImagesWithWrongIgnoredColorDiff() throws Exception {
    ImageDiffer imageDifferWithIgnored = new ImageDiffer().withIgnoredColor(Color.RED);
    ImageDiff diff = imageDifferWithIgnored.makeDiff(IMAGE_IGNORED_TEMPLATE, IMAGE_IGNORED_PASS);
    assertTrue(diff.hasDiff());
}
Also used : ImageDiff(ru.yandex.qatools.ashot.comparison.ImageDiff) ImageDiffer(ru.yandex.qatools.ashot.comparison.ImageDiffer) Test(org.junit.Test)

Example 3 with ImageDiff

use of ru.yandex.qatools.ashot.comparison.ImageDiff in project ashot by yandex-qatools.

the class DifferTest method testNonEqualImagesWithIgnoredColorDiff.

@Test
public void testNonEqualImagesWithIgnoredColorDiff() throws Exception {
    ImageDiffer imageDifferWithIgnored = new ImageDiffer().withIgnoredColor(Color.MAGENTA);
    ImageDiff diff = imageDifferWithIgnored.makeDiff(IMAGE_IGNORED_TEMPLATE, IMAGE_IGNORED_FAIL);
    assertTrue(diff.hasDiff());
}
Also used : ImageDiff(ru.yandex.qatools.ashot.comparison.ImageDiff) ImageDiffer(ru.yandex.qatools.ashot.comparison.ImageDiffer) Test(org.junit.Test)

Example 4 with ImageDiff

use of ru.yandex.qatools.ashot.comparison.ImageDiff in project ashot by yandex-qatools.

the class DifferTest method testSetDiffColor.

@Test
public void testSetDiffColor() throws Exception {
    ImageDiffer greenDiffer = new ImageDiffer().withDiffMarkupPolicy(new ImageMarkupPolicy().withDiffColor(Color.GREEN));
    ImageDiff diff = greenDiffer.makeDiff(IMAGE_A_SMALL, IMAGE_B_SMALL);
    assertThat(diff.getMarkedImage(), ImageTool.equalImage(loadImage("img/expected/green_diff.png")));
}
Also used : ImageMarkupPolicy(ru.yandex.qatools.ashot.comparison.ImageMarkupPolicy) ImageDiff(ru.yandex.qatools.ashot.comparison.ImageDiff) ImageDiffer(ru.yandex.qatools.ashot.comparison.ImageDiffer) Test(org.junit.Test)

Example 5 with ImageDiff

use of ru.yandex.qatools.ashot.comparison.ImageDiff in project ashot by yandex-qatools.

the class DifferTest method testTransparentImageWithMarkedDiff.

@Test
public void testTransparentImageWithMarkedDiff() {
    ImageDiff imageDiff = imageDiffer.makeDiff(loadImage("img/A_s.png"), loadImage("img/B_s.png"));
    assertThat(imageDiff.getTransparentMarkedImage(), ImageTool.equalImage(loadImage("img/expected/transparent_diff.png")));
}
Also used : ImageDiff(ru.yandex.qatools.ashot.comparison.ImageDiff) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)14 ImageDiff (ru.yandex.qatools.ashot.comparison.ImageDiff)14 ImageDiffer (ru.yandex.qatools.ashot.comparison.ImageDiffer)5 Screenshot (ru.yandex.qatools.ashot.Screenshot)3 BufferedImage (java.awt.image.BufferedImage)2 Coords (ru.yandex.qatools.ashot.coordinates.Coords)2 ImageMarkupPolicy (ru.yandex.qatools.ashot.comparison.ImageMarkupPolicy)1 FixedCutStrategy (ru.yandex.qatools.ashot.shooting.cutter.FixedCutStrategy)1