use of ru.yandex.qatools.ashot.coordinates.Coords 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")));
}
use of ru.yandex.qatools.ashot.coordinates.Coords in project ashot by yandex-qatools.
the class IndentCropper method cropScreenshot.
@Override
public Screenshot cropScreenshot(BufferedImage image, Set<Coords> coordsToCompare) {
Coords cropArea = createCropArea(coordsToCompare);
Coords indentMask = createIndentMask(cropArea, image);
Coords coordsWithIndent = applyIndentMask(cropArea, indentMask);
Screenshot croppedShot = super.cropScreenshot(image, Collections.singleton(coordsWithIndent));
croppedShot.setOriginShift(coordsWithIndent);
croppedShot.setCoordsToCompare(setReferenceCoords(coordsWithIndent, coordsToCompare));
List<NoFilteringArea> noFilteringAreas = createNotFilteringAreas(croppedShot);
croppedShot.setImage(applyFilters(croppedShot.getImage()));
pasteAreasToCompare(croppedShot.getImage(), noFilteringAreas);
return croppedShot;
}
use of ru.yandex.qatools.ashot.coordinates.Coords in project ashot by yandex-qatools.
the class ImageDiffer method markDiffPoints.
protected void markDiffPoints(Screenshot expected, Screenshot actual, ImageDiff diff) {
Coords expectedImageCoords = Coords.ofImage(expected.getImage());
Coords actualImageCoords = Coords.ofImage(actual.getImage());
CoordsSet compareCoordsSet = new CoordsSet(CoordsSet.union(actual.getCoordsToCompare(), expected.getCoordsToCompare()));
CoordsSet ignoreCoordsSet = new CoordsSet(CoordsSet.intersection(actual.getIgnoredAreas(), expected.getIgnoredAreas()));
int width = Math.max(expected.getImage().getWidth(), actual.getImage().getWidth());
int height = Math.max(expected.getImage().getHeight(), actual.getImage().getHeight());
diff.setDiffImage(createDiffImage(expected.getImage(), actual.getImage(), width, height));
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (ignoreCoordsSet.contains(i, j)) {
continue;
}
if (!isInsideBothImages(i, j, expectedImageCoords, actualImageCoords) || compareCoordsSet.contains(i, j) && hasDiffInChannel(expected, actual, i, j)) {
diff.addDiffPoint(i, j);
}
}
}
}
use of ru.yandex.qatools.ashot.coordinates.Coords in project ashot by yandex-qatools.
the class VerticalPastingShootingStrategyTest method testScreenshotCoordsZeroHeight.
@Test
public void testScreenshotCoordsZeroHeight() throws Exception {
shootingCoords = new Coords(0, SHOOT_COORDS_OFFSET_Y, PAGE_WIDTH, 0);
whenTakingScreenshot(shootingCoords);
thenScreenshotIsHeight(DEFAULT_COORDS_INDENT);
}
use of ru.yandex.qatools.ashot.coordinates.Coords in project ashot by yandex-qatools.
the class DifferTest method testIgnoredCoordsNotSame.
@Test
public void testIgnoredCoordsNotSame() throws Exception {
Screenshot a = createScreenshotWithIgnoredAreas(IMAGE_A_SMALL, new HashSet<>(asList(new Coords(55, 55))));
Screenshot b = createScreenshotWithIgnoredAreas(IMAGE_B_SMALL, new HashSet<>(asList(new Coords(80, 80))));
ImageDiff diff = imageDiffer.makeDiff(a, b);
assertThat(diff.getMarkedImage(), ImageTool.equalImage(loadImage("img/expected/ignore_coords_not_same.png")));
}
Aggregations