Repository navigation
Commit 9327570
authored
feat(core): Freeze UIActivityIndicatorView spinners during snapshots (#279)
* feat(core): Freeze UIActivityIndicatorView spinners during snapshots
Disabling UIView and SwiftUI animations does not stop UIActivityIndicatorView,
which drives its own layer animation. Indeterminate spinners, including the
default SwiftUI ProgressView, were captured mid-rotation and produced flaky
diffs.
Swizzle startAnimating to a no-op from RenderingStrategy.setup so every
rendering path skips spinners. Because hidesWhenStopped defaults to true, the
indicator is hidden rather than frozen at a fixed frame. This matches the
behavior the hosted Emerge runner previously injected outside the library.
* feat(core): Add opt-out for spinner freezing and exclude watchOS
Set EMERGE_DISABLE_FREEZE_SPINNERS=1 to keep UIActivityIndicatorView animating,
mirroring the existing EMERGE_DISABLE_FIX_TIME opt-out for the clock hook.
watchOS ships UIKit without UIActivityIndicatorView, so guard the swizzle the
same way other UIKit-only code in this target does. Mark the replacement
method dynamic to follow the standard swizzling idiom.
* test(demo): Add loading indicator preview to MultiModuleDemo
Add a ModuleA preview containing an indeterminate ProgressView so the CI
snapshot upload renders a spinner case. With spinner freezing in place the
image contains only the label, and any regression shows up as a diff.
* ref(core): Use snapshot-specific spinner control names
Replace company-branded names in the new spinner opt-out and swizzled
selector. Keep the Objective-C hook product-specific to avoid collisions,
and update the environment-variable test and documentation together.1 parent 856a1c1 commit 9327570
6 files changed
Lines changed: 75 additions & 1 deletion
File tree
- Examples/MultiModuleDemo
- ModuleA
- MultiModuleDemoTests
- Sources/SnapshotPreviewsCore
- Tests/SnapshotPreviewsTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | 46 | | |
34 | 47 | | |
| |||
42 | 55 | | |
43 | 56 | | |
44 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments