Commit Graph

3 Commits

Author SHA1 Message Date
Jonas Bark
a58edfbb2c test(snapshots): the Local tutorial's entry point, mouse editor and Android list
Three more shots for the Local connection tutorial, and the harness knob one of
them needed:

  - the trainer app card on the main page, which is where a rider actually
    opens Trainer Connections from ("Edit"), built from the real chain via
    buildChain rather than a hand-made ChainLink;
  - the placement editor over an in-game screenshot, with a click target on
    MyWhoosh's on-screen gear arrows;
  - the button editor as Android renders it: no keyboard row, but system
    actions, the assistant and a custom broadcast intent.

captureWidget gains an optional `height`. Without one nothing changes: the
widget still gets unbounded height inside a scroll view. With one, the surface
becomes exactly width x height and the scroll view is dropped — a full-screen
page can't live inside another viewport, and the touch-area editor in
particular maps percentage positions against MediaQuery, so it has to be
rendered at the size it reports.

The touch-area shot needs a little more staging than the others: path_provider
and window_manager are mocked (no plugin registrant runs under `flutter test`,
so path_provider falls back to its base method channel), the display size is
pinned to the surface so the notch compensation nets to zero, and it renders
with settle: false because that page never comes to rest.

`pinApp()` before each capture: registering a button a shipped keymap doesn't
have copies that keymap into a profile of its own, so the handler's app drifts
away from the one the test is editing — which the touch-area editor notices,
because it reads the keymap off the handler rather than taking it as a
parameter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 20:59:27 +02:00
Jonas Bark
20c5b80d83 test(phone-steering): snapshot the steering-wheel gauge (active + calibrating)
Add settle:false to captureWidget so callers can opt out of pumpAndSettle
when the widget contains an infinite animation (SmallProgressIndicator spinner).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 11:04:40 +02:00
Jonas Bark
423a25228d Add widget-snapshot test harness for rendering widgets to PNG
Generic flutter test harness that renders any BikeControl widget to a tight
PNG with the real app theme, localized strings, and real fonts:

- widget_to_png.dart: low-level RenderRepaintBoundary -> PNG primitives
  (renderWidgetToPng, captureBoundaryToPng).
- widget_snapshot.dart: ensureSnapshotHarness() (binding + mocks + core
  bootstrap) and captureWidget() (ShadcnApp shell mirroring main.dart's
  theme, per-locale loop, font loading via loadAssets, tight crop).
- front_shift_card_snapshot_test.dart: worked example capturing FrontShiftCard
  in 6 locales.

Used by the website repo's widget-snapshot skill.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 13:12:46 +02:00