Skip to content

Commit

Permalink
Merge pull request #4 from pazone/master
Browse files Browse the repository at this point in the history
Solved empty elements problem
  • Loading branch information
pazone committed Oct 10, 2014
2 parents a65b1e8 + 7f11c14 commit 96e4a0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ As result aShot provides he image with WebElement
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.1</version>
<version>1.2</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public abstract class CoordsProvider {
public Set<Coords> ofElements(WebDriver driver, Iterable<WebElement> elements) {
Set<Coords> elementsCoords = new HashSet<>();
for (WebElement element : elements) {
elementsCoords.add(ofElement(driver, element));
Coords elementCoords = ofElement(driver, element);
if (!elementCoords.isEmpty()) {
elementsCoords.add(ofElement(driver, element));
}
}
return elementsCoords;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Screenshot cropScreenshot(BufferedImage image, Set<Coords> coordsToCompar

Screenshot cropped = super.cropScreenshot(image, new HashSet<>(asList(coordsWithIndent)));
cropped.setCoordsToCompare(Coords.setReferenceCoords(coordsWithIndent, coordsToCompare));
List<NoFilteringArea> noFilteringAreas = createNotFilteringAreas(cropped.getImage(),cropped.getCoordsToCompare());
List<NoFilteringArea> noFilteringAreas = createNotFilteringAreas(cropped.getImage(), cropped.getCoordsToCompare());
cropped.setImage(applyFilters(cropped.getImage()));
pasteAreasToCompare(cropped.getImage(), noFilteringAreas);
return cropped;
Expand All @@ -67,7 +67,9 @@ protected Coords createIndentMask(Coords originCoords, BufferedImage image) {
protected List<NoFilteringArea> createNotFilteringAreas(BufferedImage image, Set<Coords> coordsToCompare) {
List<NoFilteringArea> noFilteringAreas = new ArrayList<>();
for (Coords noFilteringCoords : coordsToCompare) {
noFilteringAreas.add(new NoFilteringArea(image, noFilteringCoords));
if (noFilteringCoords.intersects(Coords.ofImage(image))) {
noFilteringAreas.add(new NoFilteringArea(image, noFilteringCoords));
}
}
return noFilteringAreas;
}
Expand Down

0 comments on commit 96e4a0b

Please sign in to comment.