xlsx/cell-fill-pattern--purple-white--dark-vertical

A workbook applies a <patternFill> to cell A1 using each of the 16 ST_PatternType values that carry foreground/background colours, paired with five colour families.

Library verdicts: python-xlsx: — xlsxjs: pass

Metadata

Feature idxlsx/cell-fill-pattern--purple-white--dark-vertical
Formatxlsx
Categorycell-formatting
Familyxlsx/cell-fill-pattern
Axis valuescolor=purple-white, pattern=dark-vertical
Spececma-376-5-part-1 § 18.8.20 patternFill

XPath assertions

ID / partPredicateXPathpython-xlsxxlsxjs
pattern-dark-vertical-purple-white
xl/styles.xml
exist
The styles part must contain a <patternFill> with the expected ST_PatternType value.
//x:fills/x:fill/x:patternFill[@patternType='darkVertical']

Render assertions

IDPredicateSelectorpython-xlsxxlsxjs
cell-text-dark-vertical-purple-whitecss_selector/ exist
The rendered sheet must contain the cell with the pattern fill applied.
section.xlsx tdpass
sheet-count-dark-verticalcss_selector/ equal-count
Exactly one rendered sheet section per case. Catches renderers that emit zero sheets (hard failure).
section.xlsx

Generator source

scripts/gen_cell_fill_pattern.py

#!/usr/bin/env python3
"""Generate a fixtures/xlsx/cell-fill-pattern--<color>--<pattern>.xlsx fixture."""
from __future__ import annotations

import argparse
import datetime as _dt
from pathlib import Path

from xlsx import Workbook
from xlsx.styles import PatternFill

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


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--pattern", required=True)
    parser.add_argument("--fg", required=True)
    parser.add_argument("--bg", required=True)
    parser.add_argument("--out", required=True)
    args = parser.parse_args()

    out_path = Path(args.out)
    if not out_path.is_absolute():
        out_path = _REPO_ROOT / out_path

    wb = Workbook()
    ws = wb.active
    ws["A1"] = "Filled cell"
    ws["A1"].fill = PatternFill(
        patternType=args.pattern,
        fgColor=args.fg,
        bgColor=args.bg,
    )
    out_path.parent.mkdir(parents=True, exist_ok=True)
    wb.save(out_path, zip_date_time=_REPRODUCIBLE_DT)
    print(out_path)
    return 0


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

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "xlsx/cell-fill-pattern--purple-white--dark-vertical",
  "kind": "literal",
  "title": "Cell fill pattern (16 ST_PatternType values x 5 colour pairs)",
  "format": "xlsx",
  "category": "cell-formatting",
  "summary": "A workbook applies a <patternFill> to cell A1 using each of the 16 ST_PatternType values that carry foreground/background colours, paired with five colour families.",
  "spec": {
    "source": "ecma-376-5-part-1",
    "clause": "18.8.20",
    "element": "patternFill",
    "rnc_reference": "spec/ecma-376-5/part-1/rnc/SpreadsheetML.rnc",
    "xsd_reference": "spec/ecma-376-5/part-1/xsd/sml.xsd",
    "notes": "ST_PatternType (ECMA-376 Part 1 clause 18.18.55) defines 19 pattern type values for <patternFill>. This manifest covers the 16 that accept foreground and background colours: solid, mediumGray, darkGray, lightGray, darkHorizontal, darkVertical, darkDown, darkUp, darkGrid, darkTrellis, lightHorizontal, lightVertical, lightDown, lightUp, lightGrid, lightTrellis. The three omitted values (none, gray0625, gray125) are pattern-only and do not meaningfully carry colours. Each pattern is paired with five colour families (fg/bg hex pairs). One manifest file expands into 16 x 5 = 80 concrete fixture cases. Axis ordering is alphabetised by ooxml_validate.expand_manifest, so fixture names are `<id>--<color.id>--<pattern.id>`."
  },
  "fixtures": {
    "machine": "xlsx/cell-fill-pattern--purple-white--dark-vertical"
  },
  "generator": {
    "python": "scripts/gen_cell_fill_pattern.py",
    "arg_template": "--pattern {pattern.val} --fg {color.fg} --bg {color.bg} --out fixtures/xlsx/cell-fill-pattern--{color.id}--{pattern.id}.xlsx"
  },
  "_expansion": {
    "parent_id": "xlsx/cell-fill-pattern",
    "bindings": {
      "color": "purple-white",
      "pattern": "dark-vertical"
    }
  },
  "assertions": [
    {
      "id": "pattern-dark-vertical-purple-white",
      "part": "xl/styles.xml",
      "namespaces": {
        "x": "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
      },
      "xpath": "//x:fills/x:fill/x:patternFill[@patternType='darkVertical']",
      "must": "exist",
      "description": "The styles part must contain a <patternFill> with the expected ST_PatternType value."
    }
  ],
  "render_assertions": [
    {
      "id": "cell-text-dark-vertical-purple-white",
      "kind": "css_selector",
      "selector": "section.xlsx td",
      "must": "exist",
      "description": "The rendered sheet must contain the cell with the pattern fill applied."
    },
    {
      "id": "sheet-count-dark-vertical",
      "kind": "css_selector",
      "selector": "section.xlsx",
      "must": "equal-count",
      "count": 1,
      "description": "Exactly one rendered sheet section per case. Catches renderers that emit zero sheets (hard failure)."
    }
  ]
}

Fixture

Download cell-fill-pattern--purple-white--dark-vertical.xlsx (4.8 KB)

Reference preview

Reference (machine, page 1 PNG)

xlsx/cell-fill-pattern--purple-white--dark-vertical page 1 reference

Reference PDF


Download PDF Open in PDF.js

Spec notes

ST_PatternType (ECMA-376 Part 1 clause 18.18.55) defines 19 pattern type values for <patternFill>. This manifest covers the 16 that accept foreground and background colours: solid, mediumGray, darkGray, lightGray, darkHorizontal, darkVertical, darkDown, darkUp, darkGrid, darkTrellis, lightHorizontal, lightVertical, lightDown, lightUp, lightGrid, lightTrellis. The three omitted values (none, gray0625, gray125) are pattern-only and do not meaningfully carry colours. Each pattern is paired with five colour families (fg/bg hex pairs). One manifest file expands into 16 x 5 = 80 concrete fixture cases. Axis ordering is alphabetised by ooxml_validate.expand_manifest, so fixture names are `<id>--<color.id>--<pattern.id>`.