Repository navigation
Add support for new PreviewWrapper in snapshot tests - #8
Merged
Merged
Conversation
Compose UI 1.12.0 adds the ANNOTATION_CLASS target to @PreviewWrapper, which upcoming @PreviewWrapper support needs. ASM and ui-tooling-preview become implementation dependencies of :framework so they reach consumers' test classpaths transitively. Goldens are unchanged: the bump moves no pixels. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolves androidx @PreviewWrapper on Showkase-discovered previews. The annotation has BINARY retention, so it is invisible to reflection and must be read from class-file bytes with ASM: a component's Showkase key maps to its generated host class, from there to the declaring function, whose runtime-invisible annotations are read (following custom preview annotations recursively and cycle-safely). Adds the public PreviewWrappers / PreviewFunction value types and the internal framework.wrapper pipeline. Nothing is wired into the DSL or the resolver yet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Extracts the annotation reader's private byte cache into a CachingClassBytesSource decorator shared with the call finder, so a class read during call finding is not read again while reading annotations. Adds shared name-conversion helpers and a parsing-options constant to Bytecode.kt. Chains ASM's refusal as the cause of UnsupportedClassFileException rather than dropping it, with a test pinning that the translated message stays free of the cause's near-identical text. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds the previewWrappers(...) DSL entry and carries the setting through SnapshotConfig. SnapshotResolver runs the wrapper pipeline once per tagged preview and attaches the resolved factory to each of its variants; resolution failures join the existing aggregated SnapshotConfigException. AckeeSnapshotTests creates one wrapper per snapshot and composes decorate -> density -> Wrap -> content, so previews without a wrapper render exactly as before. The primary constructor becomes internal to allow injecting a resolver in tests; internal constructors are excluded from the ABI dump, so the public surface is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Dispatches the resolution once instead of testing it twice, drops the unused default on ResolvedSnapshot.wrapper, and hoists the duplicated resolver-factory test helper into Factories. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds two sample wrappers reading MaterialTheme colours, previews using them directly and through a custom preview annotation, an unwrapped control, and object-nested and @PreviewParameter shape controls that exercise the mapper against real Showkase codegen. The 11 recorded goldens are the only regression net for the render-time nesting, which no unit test can reach; the dark ones show the wrapper picking up the dark scheme, proving decorate sits outside it. All 60 pre-existing goldens are unchanged. Documents the feature in the README and CHANGELOG and bumps the framework, paparazzi and BOM versions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replaces LabelledFrame's boolean flag with a Color parameter defaulting to the primary scheme colour. Both wrappers read MaterialTheme in the same composition, so the rendered output is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
petrs143
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PreviewWrapperworks as before