You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specs/102-contact-photo-heic-webp/behaviors.md
+22-11Lines changed: 22 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,31 @@
2
2
3
3
This document inherits all scenarios from spec 101's `behaviors.md` (JPEG and PNG paths). The scenarios below add HEIC and WebP coverage, plus regressions to ensure the existing paths remain green.
4
4
5
-
Scenarios marked **[fixture-disabled]** are implemented as `@Disabled` tests in v1, waiting on the fixture-provision TODO (`TODO.md`: "HEIC- und WebP-Testfixtures bereitstellen + Tests aktivieren"). They become active once the binary fixtures land.
5
+
**Test fixtures.** Four happy-path fixtures live under `backend/src/test/resources/images/`:
6
+
7
+
-`images/test.jpeg` — iPhone 15 Pro JPEG with EXIF/GPS, orientation 1
8
+
-`images/test.png` — 800×800 RGB, opaque
9
+
-`images/test.webp` — VP8 lossy, opaque
10
+
-`images/test.heic` — iPhone HEIF/HEVC, opaque
11
+
12
+
Scenarios marked **[fixture-disabled]** are implemented as `@Disabled` tests in v1 because they need fixture variants not yet on disk (rotated HEIC, alpha images, animated WebP, oversize, probe sample). They become active once those fixtures land (tracked in `TODO.md`: "HEIC- und WebP-Testfixtures bereitstellen + Tests aktivieren").
6
13
7
14
## Backend — HEIC upload (new path)
8
15
9
-
### Opaque HEIC upload is transcoded to JPEG[fixture-disabled]
16
+
### Opaque HEIC upload is transcoded to JPEG
10
17
11
18
-**Given** an authenticated user and an existing contact
-**When** the client posts to `POST /api/contacts/{id}/photo` with `Content-Type: image/heic`
15
22
-**Then** the response is `200 OK`
16
23
-**And** the contact's `photo_content_type` is `image/jpeg` (not `image/heic`)
17
24
-**And** the stored bytes are valid JPEG and decode to a `BufferedImage` of the original HEIC's dimensions
18
25
-**And** the stored bytes are NOT byte-equal to the uploaded HEIC
19
26
20
-
### `image/heif` content type is accepted equivalently[fixture-disabled]
27
+
### `image/heif` content type is accepted equivalently
21
28
22
-
-**Given**an HEIC file uploaded with `Content-Type: image/heif` (the parent-format MIME type some clients use)
29
+
-**Given**the fixture `images/test.heic` uploaded with `Content-Type: image/heif` (the parent-format MIME type some clients use)
23
30
-**When** the client posts it (size ≤ 2 MB, `heicAvailable == true`)
24
31
-**Then** the response is `200 OK`
25
32
-**And** the stored bytes are a valid JPEG
@@ -40,14 +47,16 @@ Scenarios marked **[fixture-disabled]** are implemented as `@Disabled` tests in
40
47
-**And** the `HeicTranscoderService` was never invoked (verifiable via mock assertions in unit tests)
41
48
-**And** the contact's `photo` column is not modified
42
49
43
-
### Malformed HEIC is rejected with 400[fixture-disabled]
50
+
### Malformed HEIC is rejected with 400
44
51
45
-
-**Given** an upload with `Content-Type: image/heic` whose bytes are not a valid HEIC (random bytes, truncated, or another format mislabelled), size ≤ 2 MB, `heicAvailable == true`
52
+
-**Given** an upload with `Content-Type: image/heic` whose bytes are a programmatically-generated random `byte[]` of length ≤ 2 MB, `heicAvailable == true`
46
53
-**When** the client posts it
47
54
-**Then** the response is `400 BAD REQUEST`
48
55
-**And** the response body contains a recognizable "could not decode HEIC" message
49
56
-**And** the contact's `photo` column is not modified
50
57
58
+
Note: this scenario uses an in-test-generated random byte array, not a disk fixture — no `@Disabled` needed.
59
+
51
60
### HEIC upload returns 415 when libheif is unavailable
52
61
53
62
-**Given** the backend has booted in an environment where `libheif` / `libheif-plugin-libde265` are missing or broken
@@ -60,10 +69,10 @@ Scenarios marked **[fixture-disabled]** are implemented as `@Disabled` tests in
60
69
61
70
## Backend — WebP upload (new path)
62
71
63
-
### Opaque lossy WebP upload is transcoded to JPEG[fixture-disabled]
72
+
### Opaque lossy WebP upload is transcoded to JPEG
64
73
65
74
-**Given** an authenticated user and an existing contact
Each is under 2 MB so each is **accepted** by the size cap and exercises the full decode → transcode → store path.
277
+
278
+
Several edge-case fixtures are **not yet present** and are tracked in `TODO.md` ("HEIC- und WebP-Testfixtures bereitstellen + Tests aktivieren"). Tests that require them ship `@Disabled` with the message `"Awaiting fixture — see TODO.md: HEIC- und WebP-Testfixtures bereitstellen"`. Missing fixtures:
284
279
285
-
All `@Disabled` annotations carry the message `"Awaiting test fixtures — see TODO.md: HEIC- und WebP-Testfixtures bereitstellen"` so the trail is unambiguous when a developer or reviewer trips over them.
280
+
-**EXIF-orientation HEIC** (e.g. `iphone-portrait-orient-6.heic`) — for the "decoded upright" test.
281
+
-**Transparent PNG / lossless WebP + alpha** — for the "flatten on white" tests.
282
+
-**Animated WebP** — for the "silent first frame" test.
283
+
-**Oversized fixtures (> 2 MB) per format** — for the size-cap test. The existing four fixtures are all under 2 MB so a separate `oversize.heic` / `oversize.webp` / `oversize.png` is required.
284
+
-**Probe sample `heic-probe/sample.heic`** (< 10 KB target) — bundled into the production JAR for `HeicSupportCheck`. The existing 1 MB `test.heic` is too large to ship inside the production artifact.
0 commit comments