Skip to content

Commit 9ff95a4

Browse files
Remove unused variables
1 parent 67573aa commit 9ff95a4

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
package com.assertthat.selenium_shutterbug.core;
77

8-
import com.assertthat.selenium_shutterbug.utils.web.ElementOutsideViewportException;
98
import com.assertthat.selenium_shutterbug.utils.image.ImageProcessor;
109
import com.assertthat.selenium_shutterbug.utils.web.Coordinates;
10+
import com.assertthat.selenium_shutterbug.utils.web.ElementOutsideViewportException;
1111
import org.openqa.selenium.WebDriver;
1212
import org.openqa.selenium.WebElement;
1313

@@ -51,7 +51,7 @@ public PageSnapshot highlight(WebElement element) {
5151
*/
5252
public PageSnapshot highlight(WebElement element, Color color, int lineWidth) {
5353
try {
54-
image = ImageProcessor.highlight(image, new Coordinates(element, devicePixelRatio), color, lineWidth);
54+
ImageProcessor.highlight(image, new Coordinates(element, devicePixelRatio), color, lineWidth);
5555
} catch (RasterFormatException rfe) {
5656
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
5757
}
@@ -93,7 +93,7 @@ public PageSnapshot highlightWithText(WebElement element, Color elementColor, in
9393
try {
9494
highlight(element, elementColor, 0);
9595
Coordinates coords = new Coordinates(element, devicePixelRatio);
96-
image = ImageProcessor.addText(image, coords.getX(), coords.getY() - textFont.getSize() / 2, text, textColor, textFont);
96+
ImageProcessor.addText(image, coords.getX(), coords.getY() - textFont.getSize() / 2, text, textColor, textFont);
9797
} catch (RasterFormatException rfe) {
9898
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
9999
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public T withThumbnail(double scale) {
176176
* @return instance of type Snapshot
177177
*/
178178
public T monochrome() {
179-
this.image = ImageProcessor.convertToGrayAndWhite(this.image);
179+
ImageProcessor.convertToGrayAndWhite(this.image);
180180
return self();
181181
}
182182

src/main/java/com/assertthat/selenium_shutterbug/utils/image/ImageProcessor.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010

1111
import java.awt.*;
1212
import java.awt.color.ColorSpace;
13-
import java.awt.image.*;
13+
import java.awt.image.BufferedImage;
14+
import java.awt.image.BufferedImageOp;
15+
import java.awt.image.ColorConvertOp;
16+
import java.awt.image.ColorModel;
17+
import java.awt.image.ConvolveOp;
18+
import java.awt.image.Kernel;
19+
import java.awt.image.PixelGrabber;
1420
import java.io.File;
1521

1622
/**
@@ -87,8 +93,7 @@ public static BufferedImage blurExceptArea(BufferedImage sourceImage, Coordinate
8793
}
8894

8995
public static BufferedImage cropAround(BufferedImage sourceImage, Coordinates coords, int offsetX, int offsetY) {
90-
BufferedImage subImage = sourceImage.getSubimage(coords.getX()-offsetX, coords.getY()-offsetY, coords.getWidth()+offsetX*2, coords.getHeight()+offsetY*2);
91-
return subImage;
96+
return sourceImage.getSubimage(coords.getX() - offsetX, coords.getY() - offsetY, coords.getWidth() + offsetX * 2, coords.getHeight() + offsetY * 2);
9297
}
9398

9499
public static BufferedImage addTitle(BufferedImage sourceImage, String title, Color color, Font textFont) {

src/main/java/com/assertthat/selenium_shutterbug/utils/web/Browser.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
import com.assertthat.selenium_shutterbug.utils.file.FileUtil;
99
import com.google.common.collect.ImmutableMap;
1010
import org.openqa.selenium.Dimension;
11-
import org.openqa.selenium.*;
11+
import org.openqa.selenium.JavascriptExecutor;
12+
import org.openqa.selenium.OutputType;
1213
import org.openqa.selenium.Point;
14+
import org.openqa.selenium.TakesScreenshot;
15+
import org.openqa.selenium.WebDriver;
16+
import org.openqa.selenium.WebElement;
1317
import org.openqa.selenium.chrome.ChromeDriver;
1418
import org.openqa.selenium.remote.CommandInfo;
1519
import org.openqa.selenium.remote.HttpCommandExecutor;
@@ -210,7 +214,7 @@ public int getViewportHeight() {
210214
}
211215

212216
public Coordinates getBoundingClientRect(WebElement element) {
213-
String script = FileUtil.getJsScript(RELATIVE_COORDS_JS);
217+
FileUtil.getJsScript(RELATIVE_COORDS_JS);
214218
ArrayList<String> list = (ArrayList<String>) executeJsScript(RELATIVE_COORDS_JS, element);
215219
Point start = new Point(Integer.parseInt(list.get(0)), Integer.parseInt(list.get(1)));
216220
Dimension size = new Dimension(Integer.parseInt(list.get(2)), Integer.parseInt(list.get(3)));

0 commit comments

Comments
 (0)