Skip to content

Deepen MainWindowViewModel test coverage#37

Merged
danielchalmers merged 3 commits into
mainfrom
claude/deepen-vm-tests
Jun 18, 2026
Merged

Deepen MainWindowViewModel test coverage#37
danielchalmers merged 3 commits into
mainfrom
claude/deepen-vm-tests

Conversation

@danielchalmers

@danielchalmers danielchalmers commented Jun 18, 2026

Copy link
Copy Markdown
Owner

What

Closes the coverage gaps left by #34 — clip filtering, seek math, and the clip→auto-play trigger — by adding two small delegate seams (no new interfaces) and 12 tests that drive a real VideoPlayerController via the existing FakeCameraPlayer.

Seams added to MainWindowViewModel (optional ctor params, real defaults)

  • Func<string, IReadOnlyList<CamClip>> clipLoader — defaults to root => CamStorage.Map(root).Clips; lets tests populate clips without disk I/O. Runtime behavior unchanged.
  • Func<Task> backgroundYield — defaults to Dispatcher.Yield(Background); lets the auto-play path run without a pumped dispatcher in tests.
  • InitializePlayer / LoadClips made public so tests can call them directly. (This is an app, not a library, so no InternalsVisibleTo ceremony.)

Tests (12 new; suite 81 → 93)

  • Filtering: newest-first ordering, case-insensitive name match, path match, no-match empty.
  • Seek math: PositionText/DurationText scale by duration; CanSeek gating; controller PositionSeekPosition mirroring; the scrub guard (controller position changes are ignored mid-drag, resume after).
  • Controller→VM mirroring: IsLoading/IsPlaying/PlayPauseIcon, and ErrorMessage → error overlay.
  • Playlist: CanGoNext/CanGoPrevious; selecting a clip triggers the auto-play loading state.
  • Extracted the existing FakeCameraPlayer into Fixtures/FakeCameraPlayer.cs (shared, no behavior change) so both test classes use one copy.

Notes

  • No new interfaces (per request). The controller-backed tests drive a real VideoPlayerController through FakeCameraPlayer (existing ICameraPlayer).
  • These tests deliberately keep all controller property changes on the test thread (no pumped dispatcher exists), documented in CreateViewModelWithController. Driving GoToClipAsync to completion would marshal onto the thread pool and deadlock, so the auto-play test asserts the trigger (IsLoading) rather than the media open — which is VideoPlayerController's own (already-tested) responsibility.
  • Reviewed the diff with a multi-agent pass (behavior-preservation, test-correctness, flakiness); applied its doc-comment suggestions.

@danielchalmers danielchalmers merged commit 24d9b95 into main Jun 18, 2026
1 check passed
@danielchalmers danielchalmers deleted the claude/deepen-vm-tests branch June 18, 2026 18:17
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.

1 participant