Skip to content

Add a UI test for escaped ViewStore from WithViewStore, and a Binding animations test bench #1819

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 3 commits into from
Jan 11, 2023

Conversation

tgrapperon
Copy link
Contributor

This adds a test case for ViewStore from WithViewStore being escaped. We're taking measures to propagate the invalidation, but this should assert that they're still effective if WithViewStore implementation changes.

The test checks simultaneously a capture by a GeometryReader, and by some Stepper's onIncrement. Both issues were solved by the same solution, but it is not exactly clear why the Stepper's escape was causing an issue, so I feel it is better to check both. Because they share the same fix, they're tested in the same UITest though. I've also checked that each would spot a regression by reverting the ViewStore copy in WithViewStore.

I've also added a Binding animations test bench. This is not checked automatically, but this puts side to side binding animations from a Vanilla ObservedObject and from a ViewStore. Various configurations are presented, so one can quickly check if the binding is animating with the same animations as the vanilla model.

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-01-11.at.00.15.45.mp4

It is maybe possible to programmatically check that things are indeed animating, but I didn't investigate farther yet. This Bindings test bench can be removed from the PR if you prefer this keep this target for automated tests only. Let me know what you think!

@mbrandonw mbrandonw merged commit db39334 into pointfreeco:main Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants