Dezio/docs/tests/S005-speechbubble.md
astar76 df1f8b39c8 S010: tests for hostile media input, web probes, results filled
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 22:50:24 -06:00

3.4 KiB

S005 — /speechbubble checks

Run in Discord (owner) unless noted. Bot must have the S005 build.

Doubts

  • GIF transparency: the image crate's GIF encoder decides which colour index is transparent and the frame disposal. If cut-out areas show old frames or a black/odd colour in an animated result, fix the encoder (key colour, disposal Background).
  • Bubble edges are not anti-aliased (hard pixels); check this looks acceptable next to the references.
  • Shape numbers (BUBBLE_HEIGHT 0.2, BUBBLE_WIDTH 0.62, tail at 0.12 to 0.28 of the width) are a guess from the reference GIFs; compare and tune.
  • Video path never run (ffmpeg and libx264 on the server). Odd video widths under 480 px may break MP4 encoding (same as /caption).
  • Prefix option words (bottom, flip, solid) are plain words in the text; a link containing them is fine, other text is ignored.

Checks

  1. Contact sheet: extract 2 frames of assets/reference/speechbubble-bsm.gif and speechbubble-assyst.gif; put the bot's solid and plain results of the same picture next to them. Shape and tail direction match.
  2. /speechbubble with a PNG attached: PNG back, transparent wide ellipse cut from the top, tail pointing down toward the right third.
  3. Same with solid:true: white fill, black outline, tail points into the picture, picture edge follows the curve.
  4. position:bottom: bubble hangs from the bottom edge, tail points up.
  5. flip:true: tail on the left third instead (also with bottom and with solid).
  6. JPG and still WebP input: PNG out, transparent (not JPG).
  7. GIF input: GIF out, still animated, bubble on every frame, transparent area stays clear (no ghost of earlier frames).
  8. Animated WebP input: GIF out.
  9. MP4, WebM, MOV without solid: GIF out with transparent bubble, at most about 10 s.
  10. Video with solid:true: MP4 out that plays, no sound, bubble on every frame.
  11. source-link:<public image link>: works. D!speechbubble <link>: works.
  12. D!speechbubble bottom flip solid replying to a picture: all three options applied.
  13. No source: uses the latest picture in the channel; nothing in the channel: clear error card.
  14. Big result (large PNG or GIF over the upload limit): retried smaller; if still too big, clear "too big" error. A solid still may come out as JPG; a transparent one never does.
  15. Bad link (http://127.0.0.1/x) and non-media file (PDF): error card, no crash.
  16. /help lists speechbubble (alias bubble); cargo test help limits test passes.
  17. Unit tests bubble_tail_flips_and_touches_chosen_edge and bubble_cuts_transparent_or_paints_solid pass (cargo test bubble).
  18. /caption still works on a picture and a video (its video code was refactored into map_frames).

Results (S010, 2026-12-01)

  • 1 pass by eye: contact sheet (reference GIF frames next to plain, solid, bottom, flip, GIF). Shape and tail direction match; edges are hard pixels but acceptable at Discord size. No tuning done.
  • 2, 3, 4, 5 pass (rendered by test on a PNG: transparent cut-out, solid white with outline, bottom hangs with tail up, flip moves the tail). 7 pass (GIF: transparent top stays clear, no ghost of earlier frames in frame 2). 16, 17 pass; 18 pass for the still and GIF path (caption_keeps_picture_kind).
  • 6, 8, 9, 10, 11, 12, 13, 14, 15: not run: Discord or video path (owner, S011).
  • Doubt GIF transparency: looked fine in ImageMagick; Discord rendering not checked.