-
Notifications
You must be signed in to change notification settings - Fork 48
Adding new feature - advanced screen comparison. #269
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of readability issues in this code (apart from the file being pretty long)
var simplifiedList = []; | ||
var previousLine; | ||
|
||
for (var y = 0; y < data.length / imageWidth / 4; y ++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think data.length / (imageWidth * 4)
would look clearer
Also - why 4? Magic variable? ✨
I can see it being used throughout the function. Consider putting it in var with descriptive name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of way data from image is provided. It reads all pixels and merges it into single array:
[r0,g0,b0,a0,r1,g1,b1,a1,...] r0 = red value from first pixel, r1 = red value from second pixel etc.
It can be named tho. I'll do it.
@@ -0,0 +1,698 @@ | |||
window.initNewComparison = function (window, document, undefined) { return function(event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indents seem to be all over the place in this file. Please fix them for readability.
} | ||
} | ||
|
||
function convertDifferenceData(data1, data2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Numbers in variable names usually make for unreadable code.
return color; | ||
} | ||
|
||
function processLines() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one monster of a function. Any way to split it into more readable chunks or simplify the logic you use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be tricky :) I'll try ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aux-lux This is great looking and very promising feature for screenshots comparison. Thank you very much for your contribution.
However, there is still some work to adjust it to the current implementation standards in AET report.
Could you please start with formatting the code according to the coding conventions?
The next step would be splitting newComparison.js
into smaller modules that would have singular responsibility. AET reports are designed using Angular, it would be great to adjust this feature into the codebase following John Papa's best practices.
All fixes done in #297 , thank you @aux-lux and @m-suchorski |
Description
Script is doing selective comparison of two images to provide precise comparison.
Motivation and Context
It's way better then recent, obviously.
I hereby agree to the terms of the AET Contributor License Agreement.