Skip to content

Commit 38d5220

Browse files
committed
Add overloaded equals
1 parent 122848a commit 38d5220

File tree

1 file changed

+24
-3
lines changed
  • src/main/java/com/assertthat/selenium_shutterbug/core

1 file changed

+24
-3
lines changed

src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public T withThumbnail(Path path, String name, double scale) {
9898
* @return instance of type Snapshot
9999
*/
100100
public T withThumbnail(double scale) {
101-
return withThumbnail(Paths.get(location.toString(),"./thumbnails").toString(),"thumb_"+fileName,scale);
101+
return withThumbnail(Paths.get(location.toString(), "./thumbnails").toString(), "thumb_" + fileName, scale);
102102
}
103103

104104
/**
@@ -200,7 +200,7 @@ public boolean equals(BufferedImage image, double deviation) {
200200
*/
201201
public boolean equalsWithDiff(BufferedImage image, String resultingImagePath) {
202202
if (this.getImage() == image) return true;
203-
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image,resultingImagePath, 0) : image == null;
203+
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image, resultingImagePath, 0) : image == null;
204204
}
205205

206206
/**
@@ -211,7 +211,28 @@ public boolean equalsWithDiff(BufferedImage image, String resultingImagePath) {
211211
*/
212212
public boolean equalsWithDiff(BufferedImage image, String resultingImagePath, double deviation) {
213213
if (this.getImage() == image) return true;
214-
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image,resultingImagePath, deviation) : image == null;
214+
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image, resultingImagePath, deviation) : image == null;
215+
}
216+
217+
/**
218+
* @param image Snapshot to compare with.
219+
* @param resultingImagePath path to save to resulting images with diff
220+
* @return true if the the provided image and current image are strictly equal.
221+
*/
222+
public boolean equalsWithDiff(Snapshot image, String resultingImagePath) {
223+
if (this == image) return true;
224+
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image.getImage(),resultingImagePath, 0) : image == null;
225+
}
226+
227+
/**
228+
* @param image Snapshot to compare with.
229+
* @param resultingImagePath path to save to resulting images with diff
230+
* @param deviation allowed deviation while comparing
231+
* @return true if the the provided image and current image are strictly equal.
232+
*/
233+
public boolean equalsWithDiff(Snapshot image, String resultingImagePath, double deviation) {
234+
if (this == image) return true;
235+
return getImage() != null ? ImageProcessor.imagesAreEqualsWithDiff(getImage(), image.getImage(),resultingImagePath, deviation) : image == null;
215236
}
216237

217238
/**

0 commit comments

Comments
 (0)