-
Notifications
You must be signed in to change notification settings - Fork 578
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
Generic Snapshots #3
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.
Really want some better naming on these protocols and protocol methods, but maybe they're OK :/
let image = UIGraphicsGetImageFromCurrentImageContext()! | ||
UIGraphicsEndImageContext() | ||
let data = UIImagePNGRepresentation(image)! | ||
var diffTool: String? = nil |
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 assign this "ksdiff"
, e.g., to print out a Kaleidoscope line.
+ ".png" | ||
|
||
let snapshotURL = URL(string: snapshotName, relativeTo: snapshotsDirectoryURL)! | ||
public protocol Diffable { |
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 protocol is used to describe types that can be diffed (images, text).
try! data.write(to: snapshotURL) | ||
return nil | ||
} | ||
public protocol Snapshot { |
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 protocol describes types that can have snapshots taken, deferring to a Diffable
type.
) | ||
|
||
return attachment | ||
XCTContext.runActivity(named: "Attached failure diff") { activity in activity.add(attachment) } |
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.
Don't need to return attachment
anymore!
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.
whoa, amazing!
23f6664
to
2a250f2
Compare
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.
amazing! I can't wait to use this!
} | ||
|
||
public func diff(comparing other: Data) -> XCTAttachment? { | ||
return nil |
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.
should we at least just do an attachment of a string with current: \(self)\nnew: \(other)
or something?
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.
Probably! I'll try to improve these soon.
) | ||
|
||
return attachment | ||
XCTContext.runActivity(named: "Attached failure diff") { activity in activity.add(attachment) } |
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.
whoa, amazing!
let image = UIGraphicsGetImageFromCurrentImageContext()! | ||
UIGraphicsEndImageContext() | ||
return image | ||
return |
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 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.
We're in a guard
😬
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.
oh lord 🙄
[Update Fork] Make image diffing strategies custom scale aware (pointfreeco#336)
This is a bit of a mess, naming/protocol-wise, and can probably be cleaned up quite a bit, but it's a start.