Attach a <p:transition> element to a slide, carrying one of the ECMA-376 slide-transition effect children (fade, push, wipe, split, reveal, randomBar, zoom, cut, flythrough). One manifest file expands into nine concrete transition test cases at runtime, each backed by a distinct fixture pptx/slide-transition--<id>.pptx generated from the same gen_slide_transition.py script parameterised by --transition <name>.
Library verdicts: python-pptx: — pptxjs: —
| Feature id | pptx/slide-transition--wipe |
|---|---|
| Format | pptx |
| Category | slide-content |
| Family | pptx/slide-transition |
| Axis values | transition=wipe |
| Spec | ecma-376-5-part-1 § 19.5.70 p:transition |
| ID / part | Predicate | XPath | python-pptx | pptxjs |
|---|---|---|---|---|
transition-is-wipeppt/slides/slide1.xml | equal = wipeThe slide's <p:transition> element must carry a single direct-child element whose local-name is the expected transition token (wipe). | local-name(//p:transition/*[1]) | — | — |
No render assertions declared.
scripts/gen_slide_transition.py
#!/usr/bin/env python3
"""Generate a single ``fixtures/pptx/slide-transition--<id>.pptx``.
Parameterised generator: the ``features/pptx/slide-transition.json``
manifest expands to one case per transition effect (fade, push, wipe,
split, reveal, randomBar, zoom, cut, flythrough), and the conformance
runner invokes this script once per case with ``--transition <name>
--out <path>``.
Each invocation produces a single-slide presentation whose ``p:sld``
element has a ``p:transition`` child carrying a single direct-child
element named ``p:<transition>``.
Since python-pptx 2026.05.0 this generator uses the high-level
``Slide.transition`` authoring API (``slide.transition.type =
PP_TRANSITION_TYPE.FADE`` and friends) for every transition name
that corresponds to a ``PP_TRANSITION_TYPE`` enum member. Two cases
in the manifest — ``reveal`` and ``flythrough`` — are PowerPoint
2010+ extensions that are not members of the ISO-29500
``CT_SlideTransition`` choice group (PowerPoint itself emits them
through ``<p:extLst><p:ext uri="..."><p14:...>`` wrappers rather
than as direct children of ``<p:transition>``). For those two the
generator falls through to a small ``lxml`` escape hatch so the
assertion (``local-name(//p:transition/*[1])``) still succeeds —
the manifest documents this caveat in its ``spec.notes``.
"""
from __future__ import annotations
import argparse
import datetime as _dt
from pathlib import Path
from lxml import etree
from pptx import Presentation
from pptx.enum.transition import PP_TRANSITION_TYPE
from pptx.oxml.ns import qn
_REPO_ROOT = Path(__file__).resolve().parent.parent
_REPRODUCIBLE_DT = _dt.datetime(2000, 1, 1, 0, 0, 0)
# -- map manifest `element` token (the XML local-name) to the matching
# -- PP_TRANSITION_TYPE enum member. Members not in this map (``reveal``
# -- and ``flythrough``) are written via the raw-lxml fallback below.
_TRANSITION_BY_TOKEN = {
member.xml_value: member
for member in PP_TRANSITION_TYPE
if member.xml_value # skip NONE (empty xml_value)
}
def _write(transition: str, out: Path) -> None:
prs = Presentation()
# "Title Only" layout — a title placeholder on an otherwise plain slide.
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Transition test"
enum_member = _TRANSITION_BY_TOKEN.get(transition)
if enum_member is not None:
# -- use the high-level authoring API (post-Foundation F8) --
slide.transition.type = enum_member
else:
# -- reveal / flythrough: 2010+ extension tokens that live
# -- outside the ISO CT_SlideTransition choice. Append the
# -- raw element as a direct child of p:transition so the
# -- local-name() assertion still matches. See the manifest
# -- spec.notes for why this is acceptable for fixture use.
sld = slide._element
transition_el = etree.SubElement(sld, qn("p:transition"))
etree.SubElement(transition_el, qn(f"p:{transition}"))
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(
"--transition",
required=True,
help="Transition child element local-name, e.g. fade, push, wipe.",
)
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.transition, out_path)
print(out_path)
return 0
if __name__ == "__main__":
raise SystemExit(main())
{
"$schema": "../manifest.schema.json",
"id": "pptx/slide-transition--wipe",
"kind": "literal",
"title": "Slide transition",
"format": "pptx",
"category": "slide-content",
"summary": "Attach a <p:transition> element to a slide, carrying one of the ECMA-376 slide-transition effect children (fade, push, wipe, split, reveal, randomBar, zoom, cut, flythrough). One manifest file expands into nine concrete transition test cases at runtime, each backed by a distinct fixture pptx/slide-transition--<id>.pptx generated from the same gen_slide_transition.py script parameterised by --transition <name>.",
"spec": {
"source": "ecma-376-5-part-1",
"clause": "19.5.70",
"element": "p:transition",
"rnc_reference": "spec/ecma-376-5/part-1/rnc/pml.rnc",
"xsd_reference": "spec/ecma-376-5/part-1/xsd/pml.xsd",
"notes": "<p:transition> carries the slide-transition effect for a slide. The choice of transition is encoded as a single direct-child element whose local-name is the effect token: fade, push, wipe, split, randomBar, zoom, cut are enumerated in p_CT_SlideTransition in the base ECMA-376 Part 1 schema. 'reveal' and 'flythrough' are PowerPoint 2010+ extensions — PowerPoint normally wraps them inside <p:extLst><p:ext uri=\"...\"><p14:...> rather than emitting them as direct children of <p:transition>. This fixture writes them as direct children of <p:transition> in the p namespace, which is sufficient to exercise the local-name identity asserted below but is not bit-for-bit what PowerPoint authors would emit for those two effects."
},
"fixtures": {
"machine": "pptx/slide-transition--wipe"
},
"generator": {
"python": "scripts/gen_slide_transition.py",
"arg_template": "--transition {transition.element} --out fixtures/pptx/slide-transition--{transition.id}.pptx"
},
"_expansion": {
"parent_id": "pptx/slide-transition",
"bindings": {
"transition": "wipe"
}
},
"assertions": [
{
"id": "transition-is-wipe",
"part": "ppt/slides/slide1.xml",
"namespaces": {
"p": "http://schemas.openxmlformats.org/presentationml/2006/main"
},
"xpath": "local-name(//p:transition/*[1])",
"must": "equal",
"value": "wipe",
"description": "The slide's <p:transition> element must carry a single direct-child element whose local-name is the expected transition token (wipe)."
}
]
}
