pptx/shape-preset-geometry--line-callout-2-accent-bar

Every python-pptx MSO_SHAPE preset round-trips to the ECMA-376 <a:prstGeom/@prst> token recorded on the enum member's xml_value. This manifest is a parameterised family: one manifest file expands into one case per MSO_SHAPE member (~180 cases), each backed by a distinct fixture pptx/shape-preset-geometry--<id>.pptx generated from the same gen_shape_preset_geometry.py script parameterised by --preset MSO_SHAPE_NAME.

Library verdicts: python-pptx: — pptxjs: pass

Metadata

Feature idpptx/shape-preset-geometry--line-callout-2-accent-bar
Formatpptx
Categoryshapes
Familypptx/shape-preset-geometry
Axis valuespreset=line-callout-2-accent-bar
Spececma-376-5-part-1 § 20.1.9.18 a:prstGeom

XPath assertions

ID / partPredicateXPathpython-pptxpptxjs
prst-is-line-callout-2-accent-bar
ppt/slides/slide1.xml
equal = accentCallout2
The slide's auto-shape must declare <a:prstGeom prst="accentCallout2"/>, matching MSO_SHAPE.LINE_CALLOUT_2_ACCENT_BAR.xml_value.
//a:prstGeom/@prst

Render assertions

IDPredicateSelectorpython-pptxpptxjs
shape-preset-line-callout-2-accent-bar-dom-presentcss_selector/ exist
A DOM node annotated as a shape (via data-shape-preset='accentCallout2', .pptx-shape, or generic data-kind='sp') must exist. pptxjs renderer support for preset geometries is weak; this assertion records whatever the renderer exposes and falls back to any descendant under a slide section.
[data-shape-preset='accentCallout2'], .pptx-shape, [data-kind='sp'], section[data-slide] *, section.slide *pass

Generator source

scripts/gen_shape_preset_geometry.py

#!/usr/bin/env python3
"""Generate a single ``fixtures/pptx/shape-preset-geometry--<id>.pptx``.

Parameterised generator: the ``features/pptx/shape-preset-geometry.json``
manifest expands to one case per :class:`pptx.enum.shapes.MSO_SHAPE`
member, and the conformance runner invokes this script once per case
with ``--preset <MSO_SHAPE_NAME> --out <path>``.

Each invocation produces a single-slide presentation containing one
auto-shape added via ``shapes.add_shape(MSO_SHAPE.<name>, ...)``. The
underlying ``<a:prstGeom/@prst>`` token is whatever python-pptx emits
for that enum member; the manifest asserts that this token matches
``MSO_SHAPE.<name>.xml_value``.
"""

from __future__ import annotations

import argparse
import datetime as _dt
from pathlib import Path

from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE
from pptx.util import Inches

_REPO_ROOT = Path(__file__).resolve().parent.parent
_REPRODUCIBLE_DT = _dt.datetime(2000, 1, 1, 0, 0, 0)


def _write(preset_name: str, out: Path) -> None:
    shape_enum = getattr(MSO_SHAPE, preset_name)
    prs = Presentation()
    # "Title Only" layout — a title placeholder we leave empty plus our shape.
    slide = prs.slides.add_slide(prs.slide_layouts[5])
    slide.shapes.add_shape(shape_enum, Inches(1), Inches(1), Inches(2), Inches(2))
    out.parent.mkdir(parents=True, exist_ok=True)
    prs.save(out, zip_date_time=_REPRODUCIBLE_DT)


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--preset",
        required=True,
        help="MSO_SHAPE member name, e.g. RECTANGLE",
    )
    parser.add_argument(
        "--out",
        required=True,
        help="Output fixture path (absolute or repo-relative)",
    )
    args = parser.parse_args()

    out_path = Path(args.out)
    if not out_path.is_absolute():
        out_path = _REPO_ROOT / out_path
    _write(args.preset, out_path)
    print(out_path)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "pptx/shape-preset-geometry--line-callout-2-accent-bar",
  "kind": "literal",
  "title": "Shape preset geometry",
  "format": "pptx",
  "category": "shapes",
  "summary": "Every python-pptx MSO_SHAPE preset round-trips to the ECMA-376 <a:prstGeom/@prst> token recorded on the enum member's xml_value. This manifest is a parameterised family: one manifest file expands into one case per MSO_SHAPE member (~180 cases), each backed by a distinct fixture pptx/shape-preset-geometry--<id>.pptx generated from the same gen_shape_preset_geometry.py script parameterised by --preset MSO_SHAPE_NAME.",
  "spec": {
    "source": "ecma-376-5-part-1",
    "clause": "20.1.9.18",
    "element": "a:prstGeom",
    "rnc_reference": "spec/ecma-376-5/part-1/rnc/DrawingML.rnc",
    "xsd_reference": "spec/ecma-376-5/part-1/xsd/dml-shape.xsd",
    "notes": "DrawingML <a:prstGeom prst=\"...\"/> selects one of the ~180 preset auto-shape geometries enumerated in the ST_ShapeType simple type. python-pptx exposes these via pptx.enum.shapes.MSO_SHAPE, where each enum member's xml_value attribute holds the prst token emitted into the XML. This family asserts the identity: for every MSO_SHAPE member, shapes.add_shape(member, ...) emits <a:prstGeom prst=\"member.xml_value\"/>."
  },
  "fixtures": {
    "machine": "pptx/shape-preset-geometry--line-callout-2-accent-bar"
  },
  "generator": {
    "python": "scripts/gen_shape_preset_geometry.py",
    "arg_template": "--preset {preset.mso} --out fixtures/pptx/shape-preset-geometry--{preset.id}.pptx"
  },
  "_expansion": {
    "parent_id": "pptx/shape-preset-geometry",
    "bindings": {
      "preset": "line-callout-2-accent-bar"
    }
  },
  "assertions": [
    {
      "id": "prst-is-line-callout-2-accent-bar",
      "part": "ppt/slides/slide1.xml",
      "namespaces": {
        "p": "http://schemas.openxmlformats.org/presentationml/2006/main",
        "a": "http://schemas.openxmlformats.org/drawingml/2006/main"
      },
      "xpath": "//a:prstGeom/@prst",
      "must": "equal",
      "value": "accentCallout2",
      "description": "The slide's auto-shape must declare <a:prstGeom prst=\"accentCallout2\"/>, matching MSO_SHAPE.LINE_CALLOUT_2_ACCENT_BAR.xml_value."
    }
  ],
  "render_assertions": [
    {
      "id": "shape-preset-line-callout-2-accent-bar-dom-present",
      "kind": "css_selector",
      "selector": "[data-shape-preset='accentCallout2'], .pptx-shape, [data-kind='sp'], section[data-slide] *, section.slide *",
      "must": "exist",
      "description": "A DOM node annotated as a shape (via data-shape-preset='accentCallout2', .pptx-shape, or generic data-kind='sp') must exist. pptxjs renderer support for preset geometries is weak; this assertion records whatever the renderer exposes and falls back to any descendant under a slide section."
    }
  ]
}

Fixture

Download shape-preset-geometry--line-callout-2-accent-bar.pptx (27.6 KB)

Reference preview

Reference (machine, page 1 PNG)

pptx/shape-preset-geometry--line-callout-2-accent-bar page 1 reference

Reference PDF


Download PDF Open in PDF.js

Spec notes

DrawingML <a:prstGeom prst="..."/> selects one of the ~180 preset auto-shape geometries enumerated in the ST_ShapeType simple type. python-pptx exposes these via pptx.enum.shapes.MSO_SHAPE, where each enum member's xml_value attribute holds the prst token emitted into the XML. This family asserts the identity: for every MSO_SHAPE member, shapes.add_shape(member, ...) emits <a:prstGeom prst="member.xml_value"/>.