McRogueFace/tests/snippets/019_caption_dimensions.py
John McCardle 3a85dd818d fix(snippets): drop the commit hash from verified -- it churned all 130 every commit
The `# mcrf:` stamp recorded verified=<version>@<commit>, so every commit rewrote
the hash in all 130 snippet headers -- a guaranteed 130-file diff carrying no signal
git history doesn't already have, and one `--check` ignores anyway. The version alone
is stable within a dev cycle ("0.2.8-dev") and becomes the release marker at a tag
("0.2.9"), which is the whole point of the field: freezing a version into the docs
site's history, not pinning a commit.

verified is now version-only. The stamper is idempotent again: a second run on a
clean tree changes zero files. This commit is the one-time normalization that strips
the @hash suffix from the existing headers.

Found while cleaning up after a make release-docs run left all 130 snippets dirty
with nothing but hash churn.
2026-07-14 19:14:49 -04:00

36 lines
956 B
Python

# mcrf: objects=[Caption,Color,Frame,Scene] verified=0.2.8-dev status=ok
# Caption Dimensions - Text width and height
import mcrfpy
scene = mcrfpy.Scene("demo")
mcrfpy.current_scene = scene
texts = [
"Short",
"A medium length text",
"This is a much longer piece of text to display",
]
y = 150
for text in texts:
# Create caption
cap = mcrfpy.Caption(text=text, pos=(100, y))
cap.fill_color = mcrfpy.Color(255, 255, 255)
scene.children.append(cap)
# Bounding box showing dimensions
box = mcrfpy.Frame(
pos=(100, y - 5),
size=(cap.w, cap.h + 10),
fill_color=mcrfpy.Color(0, 0, 0, 0),
outline=1.0,
outline_color=mcrfpy.Color(255, 100, 100)
)
scene.children.append(box)
# Show dimensions
dims = mcrfpy.Caption(text=f"w={cap.w:.0f}, h={cap.h:.0f}", pos=(100, y + 50))
dims.fill_color = mcrfpy.Color(150, 150, 150)
scene.children.append(dims)
y += 150