Repository navigation
3.0.1
Added
-
Screenshot coverage from a single annotation. A
@Previewcomposable marked@Mugshotnow gets
a golden image with no test file to write: the Gradle plugin generates a parameterised JUnit test
that renders every annotated preview in the module, one case each so a failure names the preview
that broke. Apply KSP alongside the plugin and the annotations, preview runtime and processor are
supplied for you — thekspblock, the processor dependency and the namespace argument are gone. -
Axis annotations that configure what gets rendered, and multiply when stacked:
@MugshotShrink,
@MugshotFullScreen,@MugshotDevices,@MugshotWear,@MugshotLightDark,
@MugshotFontScales,@MugshotLocalesand@MugshotMatrix. All of them target annotation
classes as well as functions, so a team can bundle its house style behind one name. RTL layout is
inferred from the locale. -
mugshot-preview-junit, a new artifact holding the bridge from a generated preview case to a
Mugshotrule. It is added totestImplementationby the plugin. -
Lint warning
MugshotPreviewArgumentsIgnored, reported when a@Mugshotfunction's@Preview
sets configuration Mugshot does not read, so the IDE preview and the golden cannot silently
diverge. -
@Mugshotpreviews may take a@PreviewParameter. The processor cannot enumerate a
PreviewParameterProviderat compile time, so generated code defers toparameterizedFramesin
mugshot-preview-runtime, which expands the provider's values when the test runs. Each value
becomes its own image, named by position (_0,_1, ...) rather than by the value, so golden
filenames stay deterministic. ThePreviewParametersNotSupportedlint check is gone.
Fixed
- A
@Mugshotfunction carrying more than one@Previewgenerated one entry per@Preview, each
with an identicalsnapshotName. No@Previewargument is read, so those entries were
indistinguishable and their goldens collided. One entry is now generated per function. - The
PreviewAnnotationNotFoundlint check only looked at direct annotations while the processor
resolved@Previewrecursively. A@Mugshotfunction reaching@Previewthrough a custom
multi-preview annotation generated correctly and then failed lint. The check now walks annotation
trees the same way the processor does.
Changed
-
Breaking:
mugshot-preview-runtimenow exposesMugshotPreviewCaseand
MugshotPreviewConfigin place ofMugshotPreviewData, andparameterizedFramesin place of
parameterizedPreviews. The generated property ismugshotPreviewCases, notmugshotPreviews.
Hand-written tests that iterated the old list can be deleted — the plugin generates one. -
Breaking:
@Previewarguments are not read. Configuration comes from the Mugshot annotations
instead; see the lint warning above. -
Breaking: the project is renamed from Paparazzi to Mugshot. There is no
compatibility layer — every name below changes at once:- Maven group
app.cash.paparazzi->uk.co.fractalmotion.mugshot, and the
artifactspaparazzi,paparazzi-gradle-plugin,paparazzi-annotations,
paparazzi-preview-{runtime,processor,lints}gain themugshotprefix. - Gradle plugin id
app.cash.paparazzi->uk.co.fractalmotion.mugshot. - Kotlin package
app.cash.paparazzi.**->uk.co.fractalmotion.mugshot.**. - Types
Paparazzi->Mugshot,PaparazziSdk->MugshotSdk, and the
@Paparazziannotation ->@Mugshot. - Tasks
recordPaparazzi*,verifyPaparazzi*,cleanRecordPaparazzi*,
deletePaparazziSnapshots-> the same names withMugshot. - System properties
paparazzi.*->mugshot.*, and Gradle properties
app.cash.paparazzi.*->uk.co.fractalmotion.mugshot.*. - Output directories
build/reports/paparazzi->build/reports/mugshotand
build/paparazzi/failures->build/mugshot/failures.
Golden snapshot filenames embed the test's package name, so renaming your own
test packages renames your goldens. Rename the files rather than re-recording
if you want to prove the rebrand changed no pixels. - Maven group
-
Breaking: snapshots are now stored as lossless WebP (
.webp) instead of PNG. Re-record your
goldens with./gradlew recordMugshot<Variant>; existing.pnggoldens are not read.
Removed
- Breaking: removed accessibility snapshot rendering and validation.
- Breaking: removed animated snapshot support.
Mugshot#gifandMugshotSdk#gifare gone,
along with thesnapshots/videosdirectory. Mugshot now records a single frame per snapshot.
UseMugshot#snapshot(view, offsetMillis)to capture a specific point in an animation, or
InstantAnimationsRuleto snapshot an animation's terminal state. - Breaking:
SnapshotHandler#newFrameHandlerno longer takesframeCountandfps. Custom
SnapshotHandlerimplementations must drop those parameters.