-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add a snapshot test for Path
SVG layout
#412
Conversation
…apshot-tests # Conflicts: # Package.swift # Tests/TokamakStaticHTMLTests/HTMLTests.swift
LazyVGrid
CSS layoutPath
SVG layout
@@ -40,20 +40,9 @@ final class ReconcilerStressTests: XCTestCase { | |||
let renderer = TestRenderer(SpookyHanger()) | |||
let root = renderer.rootTarget | |||
|
|||
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.
This test was invalid, but the return
statement made this undiscoverable. Cleaning that up and simplifying the test to actually pass.
import Foundation | ||
|
||
/// The outline of a 2D shape. | ||
public struct Path: Equatable, LosslessStringConvertible { |
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 a smaller version of the original Path.swift
that satisfies linter's file length constraints.
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.
Nice!
Depends on #253.
This adds a dependency on the SnapshotTesting library, which allows testing our SVG layout algorithm end-to-end. We use the
--screenshot
flag of Chromium-based browsers (MS Edge in this case) to produce a PNG snapshot of a view rendered withStaticHTMLRenderer
.This test works only on macOS for now due to its dependency on
NSImage
, but that should be fine as we'd expect the same SVG output to be rendered in the same way on all platforms.