Skip to content
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

Merged
merged 31 commits into from
Jun 21, 2021
Merged

Add a snapshot test for Path SVG layout #412

merged 31 commits into from
Jun 21, 2021

Conversation

MaxDesiatov
Copy link
Collaborator

@MaxDesiatov MaxDesiatov commented Jun 19, 2021

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 with StaticHTMLRenderer.

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.

@MaxDesiatov MaxDesiatov added test suite Changes to the framework's test suite DOM/HTML renderer Tokamak in the browser labels Jun 19, 2021
@MaxDesiatov MaxDesiatov requested a review from a team June 19, 2021 12:16
Base automatically changed from foundation-types to main June 19, 2021 18:29
@MaxDesiatov MaxDesiatov removed the request for review from a team June 19, 2021 22:35
@MaxDesiatov MaxDesiatov marked this pull request as draft June 19, 2021 22:35
@MaxDesiatov MaxDesiatov changed the base branch from main to padding-fusion June 20, 2021 18:30
@MaxDesiatov MaxDesiatov changed the title Add a snapshot test for LazyVGrid CSS layout Add a snapshot test for Path SVG layout Jun 20, 2021
@MaxDesiatov MaxDesiatov marked this pull request as ready for review June 20, 2021 18:32
@MaxDesiatov MaxDesiatov requested a review from a team June 20, 2021 19:07
@@ -40,20 +40,9 @@ final class ReconcilerStressTests: XCTestCase {
let renderer = TestRenderer(SpookyHanger())
let root = renderer.rootTarget

return
Copy link
Collaborator Author

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 {
Copy link
Collaborator Author

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.

Copy link
Contributor

@foscomputerservices foscomputerservices left a comment

Choose a reason for hiding this comment

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

Nice!

Base automatically changed from padding-fusion to main June 21, 2021 15:00
@MaxDesiatov MaxDesiatov merged commit d35e37c into main Jun 21, 2021
@MaxDesiatov MaxDesiatov deleted the snapshot-tests branch June 21, 2021 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM/HTML renderer Tokamak in the browser test suite Changes to the framework's test suite
Development

Successfully merging this pull request may close these issues.

2 participants