pptx/shape-oval

A slide carries an oval (ellipse) auto-shape whose preset geometry is 'ellipse' and whose text body contains a label.

Library verdicts: python-pptx: — pptxjs: fail

Metadata

Feature idpptx/shape-oval
Formatpptx
Categoryshapes
Spececma-376-5-part-1 § 20.1.9.18 a:prstGeom

XPath assertions

ID / partPredicateXPathpython-pptxpptxjs
oval-preset-geom-ellipse
ppt/slides/slide1.xml
equal = ellipse
The shape carrying the 'Oval shape' text must declare <a:prstGeom prst="ellipse"/>.
//p:sp[.//a:t[normalize-space()='Oval shape']]/p:spPr/a:prstGeom/@prst
oval-text-present
ppt/slides/slide1.xml
exist
A <p:sp> must contain an <a:t> run whose value is 'Oval shape'.
//p:sp//a:t[normalize-space()='Oval shape']

Render assertions

IDPredicateSelectorpython-pptxpptxjs
oval-text-visiblecss_selector/ match-text = Oval shape
A DOM node annotated as an ellipse/oval shape (via data-shape-preset) or a generic slide paragraph must carry the 'Oval shape' text.
[data-shape-preset='ellipse'], [data-shape-preset='oval'], section[data-slide] p, section.slide pfail
slide-countcss_selector/ equal-count
Exactly one slide container must be rendered. Catches renderers that emit zero slides (hard failure) or duplicate the slide.
section.pptx-slide, .pptx-slide, section[data-slide], .slide, [data-slide]

Generator source

scripts/gen_shape_oval.py

#!/usr/bin/env python3
"""Generate ``fixtures/pptx/shape-oval.pptx``.

A one-slide presentation carrying an oval (ellipse) auto-shape with a
text label. Designed to satisfy the assertions in
``features/pptx/shape-oval.json``.
"""

from __future__ import annotations

from pathlib import Path

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

import datetime as _dt
_REPRODUCIBLE_DT = _dt.datetime(2000, 1, 1, 0, 0, 0)

_REPO_ROOT = Path(__file__).resolve().parent.parent
_OUT = _REPO_ROOT / "fixtures" / "pptx" / "shape-oval.pptx"


def main() -> int:
    prs = Presentation()
    slide = prs.slides.add_slide(prs.slide_layouts[5])
    shape = slide.shapes.add_shape(
        MSO_SHAPE.OVAL, Inches(1), Inches(1), Inches(3), Inches(2)
    )
    shape.text_frame.text = "Oval shape"
    _OUT.parent.mkdir(parents=True, exist_ok=True)
    prs.save(_OUT, zip_date_time=_REPRODUCIBLE_DT)
    print(_OUT)
    return 0


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

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "pptx/shape-oval",
  "title": "Oval (ellipse) preset-geometry shape",
  "format": "pptx",
  "category": "shapes",
  "summary": "A slide carries an oval (ellipse) auto-shape whose preset geometry is 'ellipse' and whose text body contains a label.",
  "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": "python-pptx emits shapes.add_shape(MSO_SHAPE.OVAL, ...) as a <p:sp> whose <p:spPr>/<a:prstGeom> declares prst=\"ellipse\". The oval's text lives in the shape's <p:txBody>."
  },
  "fixtures": {
    "machine": "pptx/shape-oval",
    "office": "pptx/shape-oval"
  },
  "generator": {
    "python": "scripts/gen_shape_oval.py"
  },
  "assertions": [
    {
      "id": "oval-preset-geom-ellipse",
      "part": "ppt/slides/slide1.xml",
      "namespaces": {
        "p": "http://schemas.openxmlformats.org/presentationml/2006/main",
        "a": "http://schemas.openxmlformats.org/drawingml/2006/main"
      },
      "xpath": "//p:sp[.//a:t[normalize-space()='Oval shape']]/p:spPr/a:prstGeom/@prst",
      "must": "equal",
      "value": "ellipse",
      "description": "The shape carrying the 'Oval shape' text must declare <a:prstGeom prst=\"ellipse\"/>."
    },
    {
      "id": "oval-text-present",
      "part": "ppt/slides/slide1.xml",
      "namespaces": {
        "p": "http://schemas.openxmlformats.org/presentationml/2006/main",
        "a": "http://schemas.openxmlformats.org/drawingml/2006/main"
      },
      "xpath": "//p:sp//a:t[normalize-space()='Oval shape']",
      "must": "exist",
      "description": "A <p:sp> must contain an <a:t> run whose value is 'Oval shape'."
    }
  ],
  "render_assertions": [
    {
      "id": "oval-text-visible",
      "kind": "css_selector",
      "selector": "[data-shape-preset='ellipse'], [data-shape-preset='oval'], section[data-slide] p, section.slide p",
      "must": "match-text",
      "value": "Oval shape",
      "description": "A DOM node annotated as an ellipse/oval shape (via data-shape-preset) or a generic slide paragraph must carry the 'Oval shape' text."
    },
    {
      "id": "slide-count",
      "kind": "css_selector",
      "selector": "section.pptx-slide, .pptx-slide, section[data-slide], .slide, [data-slide]",
      "must": "equal-count",
      "count": 1,
      "description": "Exactly one slide container must be rendered. Catches renderers that emit zero slides (hard failure) or duplicate the slide."
    }
  ]
}

Fixture

Download shape-oval.pptx (27.6 KB)

Reference preview

Reference (machine, page 1 PNG)

pptx/shape-oval page 1 reference

Reference PDF


Download PDF Open in PDF.js

Spec notes

python-pptx emits shapes.add_shape(MSO_SHAPE.OVAL, ...) as a <p:sp> whose <p:spPr>/<a:prstGeom> declares prst="ellipse". The oval's text lives in the shape's <p:txBody>.