Skip to content

Cleaning and extract image comparison #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 4, 2019

Conversation

BielinskiLukasz
Copy link
Contributor

Hello :)
I work with your code this week, great job. I made some cleaning there (removing doubles etc.). I extracted image comparison methods from ImageProcessor to a new class.

commit 6de649e
I'm not sure that the line is correct:
_viewportHeight -= scrollBarMaxWidth;

@glibas glibas self-requested a review June 3, 2019 11:10
@glibas glibas self-assigned this Jun 3, 2019
Copy link
Member

@glibas glibas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BielinskiLukasz ,

Thank you for your contribution! Great work, never got around refactoring myself:)

Please find some comments on src/main/java/com/assertthat/selenium_shutterbug/core/PageSnapshot.java
and
src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java

The rest looks great.

Regards,
Glib

@@ -51,7 +51,7 @@ public PageSnapshot highlight(WebElement element) {
*/
public PageSnapshot highlight(WebElement element, Color color, int lineWidth) {
try {
image = ImageProcessor.highlight(image, new Coordinates(element, devicePixelRatio), color, lineWidth);
ImageProcessor.highlight(image, new Coordinates(element, devicePixelRatio), color, lineWidth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to keep assignment to image so subsequent chained methods can use updated image.

@@ -93,7 +93,7 @@ public PageSnapshot highlightWithText(WebElement element, Color elementColor, in
try {
highlight(element, elementColor, 0);
Coordinates coords = new Coordinates(element, devicePixelRatio);
image = ImageProcessor.addText(image, coords.getX(), coords.getY() - textFont.getSize() / 2, text, textColor, textFont);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to keep assignment to image so subsequent chained methods can use updated image.

@@ -176,7 +185,7 @@ public T withThumbnail(double scale) {
* @return instance of type Snapshot
*/
public T monochrome() {
this.image = ImageProcessor.convertToGrayAndWhite(this.image);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to keep assignment to image so subsequent chained methods can use updated image.

@BielinskiLukasz
Copy link
Contributor Author

Thanks for quick response and code review.

What about @6de649e commit? I didn't test other combination but there is assignment scrollBarMaxWidth to _viewportHeight and next again scrollBarMaxWidth to _viewportWidth. I am wondering about the multiple uses of width. If it's correct, there is TODO what I created, should be removed :)

@glibas
Copy link
Member

glibas commented Jun 4, 2019

Hi @BielinskiLukasz ,

Regarding @6de649e, I think we should leave this as is. scrollBarMaxWidth is standard so it is used for both - removing vertical and horizontal scrollbars if present.

@glibas glibas merged commit 9226713 into assertthat:master Jun 4, 2019
glibas added a commit that referenced this pull request Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants