use of ru.yandex.qatools.ashot.Screenshot 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.Screenshot in project ashot by yandex-qatools.
the class SerializeScreenshotTest method serializeWithoutIgnoredAreas.
@Test
public void serializeWithoutIgnoredAreas() throws IOException, ClassNotFoundException {
Screenshot screenshot = new Screenshot(IMAGE_A_SMALL);
try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(serializedFile))) {
objectOutputStream.writeObject(screenshot);
}
try (ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(serializedFile))) {
Screenshot deserialized = (Screenshot) objectInputStream.readObject();
checkDeserializedScreenshot(screenshot, deserialized);
}
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class CroppersTest method testElementOutsideImageDefCropper.
@Test
public void testElementOutsideImageDefCropper() throws Exception {
Screenshot screenshot = new DefaultCropper().cropScreenshot(IMAGE_A_SMALL, OUTSIDE_IMAGE);
assertThat(screenshot.getImage(), ImageTool.equalImage(loadImage("img/expected/outside_dc.png")));
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class DifferTest method createScreenshotWithIgnoredAreas.
private Screenshot createScreenshotWithIgnoredAreas(BufferedImage image, Set<Coords> ignored) {
Screenshot screenshot = new Screenshot(image);
screenshot.setIgnoredAreas(ignored);
return screenshot;
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class DifferTest method testIgnoredCoordsSame.
@Test
public void testIgnoredCoordsSame() throws Exception {
Screenshot a = createScreenshotWithSameIgnoredAreas(IMAGE_A_SMALL);
Screenshot b = createScreenshotWithSameIgnoredAreas(IMAGE_B_SMALL);
ImageDiff diff = imageDiffer.makeDiff(a, b);
assertThat(diff.getMarkedImage(), ImageTool.equalImage(loadImage("img/expected/ignore_coords_same.png")));
}
Aggregations