# Test — PhotoMode Switch & yoloId Wire

**Task**: AZ-473_test_photo_mode
**Name**: PhotoMode switch + auto-select + yoloId offsetting on the wire
**Description**: Implement the 3 blackbox tests pinning PhotoMode behavior: switching modes sets the offset filter, auto-selecting when the prior class is no longer valid, and the on-wire `classNum == classId + photoModeOffset` assertion.
**Complexity**: 2 points
**Dependencies**: AZ-456_test_infrastructure
**Component**: 06_annotations (PhotoModeContext + AnnotationsPage) (Blackbox Tests)
**Tracker**: AZ-473
**Epic**: AZ-455

## Problem

PhotoMode offsets `classId` to `classNum` on the wire (`classNum == classId + photoModeOffset`). Getting this wrong leaks a different class on every save without any user-visible symptom — until a downstream consumer mis-buckets the data.

## Outcome

- 3 scenarios pass — mode switch, auto-select on invalid, wire offset arithmetic.

## Scope

### Included

| Scenario | Profile | Source file |
|----------|---------|-------------|
| FT-P-48 — PhotoMode switch — mode set + filter | fast | blackbox-tests.md |
| FT-P-49 — PhotoMode auto-select when prior class no longer valid | fast | blackbox-tests.md |
| FT-P-50 — yoloId on the wire — `classNum == classId + photoModeOffset` | fast + e2e | blackbox-tests.md |

### Excluded

- DetectionClasses load + hotkeys (covered in 17_test_detection_classes).

## Acceptance Criteria

**AC-1: Switch sets filter**
FT-P-48 — toggling PhotoMode updates the rendered class list (filter applied); the selected mode is persisted in `<PhotoModeContext>` (asserted via the rendered filter, not via context read).

**AC-2: Auto-select**
FT-P-49 — switching to a mode where the currently-selected class is out-of-range auto-selects the first valid class in the new window.

**AC-3: Wire offset**
FT-P-50 — issue an annotation save in mode P; outbound body carries `classNum == classId + P` for every detection.

## System Under Test Boundary

- System under test: `<PhotoModeContext>` + `<AnnotationsPage>` save call.
- Allowed stubs: MSW for `/api/annotations/classes` + annotation save.
- Disallowed: reading `<PhotoModeContext>` state directly.
- Expected observables per `results_report.md` rows 77-80 region.

## Constraints

- Tests exercise all three modes (P ∈ {0, 20, 40}); each saves a probe annotation and asserts the wire offset.
