test(pdf): a described shape is exactly one Figure

The test checked that the description is there, so a Figure written twice
would still pass. It now also counts the alt text entries.

Suggested by the CodeRabbit review of this PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MyAIPlugins
2026-10-19 18:36:37 +02:00
committed by myaiplugins
co-authored by Claude Opus 5.5
parent 73d159b6c9
commit 322b3d765c
+1
View File
@@ -1903,6 +1903,7 @@ fn described_shapes_are_figures_with_their_description() {
for (name, float) in cases {
let raw = tagged_shape_pdf(Float { alt: described.clone(), ..float.clone() }, false);
assert!(raw.contains("/Alt(Arrow pointing to the exit)"), "{name}: a described shape is a Figure with its description");
assert_eq!(raw.matches("/Alt(").count(), 1, "{name}: the described shape is one Figure");
assert!(raw.contains("0 0 1 rg"), "{name}: the shape is drawn");
assert!(!tagged_shape_pdf(float.clone(), false).contains("/Alt("), "{name}: an undescribed shape stays an artifact");
let decorative = AltText { decorative: true, ..described.clone() };