Skip to content

test: cover full-screen viewer state and chrome#1497

Open
agent-p1p wants to merge 2 commits into
masterfrom
pip/whitenoise-android-1473
Open

test: cover full-screen viewer state and chrome#1497
agent-p1p wants to merge 2 commits into
masterfrom
pip/whitenoise-android-1473

Conversation

@agent-p1p

@agent-p1p agent-p1p commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1473

Summary

  • extract shared pure paging, zoom/pan, reset, and avatar drag-dismiss transitions used by both full-screen viewers
  • add 15 focused state-transition tests per flavor
  • extract reusable viewer frame composables and add visually reviewed 360x780 Roborazzi baselines for the media and avatar default loading frames

Verification

  • ./gradlew :app:compileDevZapstoreDebugKotlin :app:compileDevPlayDebugKotlin --no-daemon --stacktrace
  • ./gradlew :app:testDevZapstoreDebugUnitTest :app:testDevPlayDebugUnitTest --no-daemon --stacktrace (2,190 Zapstore + 2,164 Play tests; 0 failures)
  • ./gradlew :app:verifyRoborazziDevZapstoreDebug :app:verifyRoborazziDevPlayDebug --no-daemon --stacktrace
  • ./gradlew :app:ktlintCheck --no-daemon --stacktrace
  • ./gradlew :app:lintDevZapstoreDebug :app:lintDevPlayDebug --no-daemon --stacktrace

Sensitive paths

None.


Open in Stage

Extract shared paging, zoom, pan, and avatar-dismiss transitions into
pure helpers used by both viewers. Add focused unit coverage and
Roborazzi baselines for each default loading frame.

Fixes #1473
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@agent-p1p, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3072beb2-9ca0-41be-b2be-68ada23236f5

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6654d and 46cef76.

⛔ Files ignored due to path filters (2)
  • app/src/test/snapshots/avatar_viewer_default_frame.png is excluded by !**/*.png
  • app/src/test/snapshots/media_viewer_default_frame.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • app/src/main/java/dev/ipf/whitenoise/android/ui/common/ViewerState.kt
  • app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/media/MediaViewer.kt
  • app/src/main/java/dev/ipf/whitenoise/android/ui/profile/AvatarViewer.kt
  • app/src/test/java/dev/ipf/whitenoise/android/ui/common/ViewerStateTest.kt
  • app/src/test/java/dev/ipf/whitenoise/android/ui/screenshot/AvatarViewerScreenshotTest.kt
  • app/src/test/java/dev/ipf/whitenoise/android/ui/screenshot/MediaViewerScreenshotTest.kt
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pip/whitenoise-android-1473

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stage-review

stage-review Bot commented Jul 16, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Extract shared viewer state and transition logic
2 Refactor MediaViewer to use shared logic
3 Refactor AvatarViewer to use shared logic
4 Add screenshot tests for viewer frames
5 Other changes
Open in Stage

Chapters generated by Stage for commit 46cef76 on Jul 16, 2026 4:55pm UTC.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Preview APK for PR #1497

Home-screen label: 1497 White Noise with the blueprint launcher icon — installs side-by-side with the production and staging apps.

Install directly — one tap, no GitHub sign-in (public, content-addressed .apk). ARM64 only.

Every push to this PR rebuilds and updates this comment.

@agent-p1p

Copy link
Copy Markdown
Contributor Author

Pip adversarial review

Reviewed exact head 4fefa3f1b19c5d4317779e897cb0acc24e0217b5 against issue #1473.

Verdict: no blocking findings. The shared pure transitions preserve the existing viewer behavior, both viewer frames now have committed 360×780 baselines, and the requested paging/zoom/pan/dismiss cases are covered.

Suggestions

  1. MediaViewer.kt:177,206 — derive one bounded currentPageIndex and use it for both currentPage and MediaViewerFrame.pageIndex. The code correctly notes that PagerState.currentPage can remain stale for a frame after pages shrinks, but the frame still receives the raw value; it can transiently render 3 / 2 while save/share target the clamped page. Reusing one bounded index is both simpler and consistent.
  2. ViewerStateTest.kt:59-79 — assert a concrete pan boundary instead of deriving the expected value through viewerPanExtents, which is part of the helper chain under test. For the current landscape fixture, maxX is 180f and maxY is 0f; a portrait fixture would independently cover vertical clamping. The current assertion can stay green if both geometry and transform logic regress together.

Verification

  • Forced rerun of the three added suites for both Dev Zapstore and Dev Play: 34/34 tests passed.
  • Forced rerun of both verifyRoborazzi tasks and :app:ktlintCheck: passed.
  • Both committed baselines were inspected visually; chrome, loading spinner, counter/actions, and caption layout are present with no clipping.
  • git diff --check: passed.
  • GitHub PR APK jobs are green. Android CI was still running when this review was posted; no CI conclusion is implied here.

Sensitive paths touched: none.

@agent-p1p

Copy link
Copy Markdown
Contributor Author

Addressed both adversarial review suggestions in signed commit 46cef76d:

  • one clamped currentPageIndex now drives both selected content/actions and MediaViewerFrame chrome
  • pan-clamp tests now assert concrete horizontal and vertical bounds without deriving expectations through viewerPanExtents

All five exact Android CI commands pass locally.

@agent-p1p
agent-p1p marked this pull request as ready for review July 16, 2026 17:09
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.

Test media viewer and avatar viewer — extract state + add coverage

1 participant