Gate texel density and review scorecard coverage
Full build / Import + headless tests (push) Successful in 43s
Full build / Full desktop build + optional release (push) Skipped

This commit is contained in:
zwitschi committed 2026-11-03 11:52:19 +01:00
1 parent 88a0793bba
commit fe3ba3054e
4 files changed
+88 -2

No files matched your search

+16
View File
@@ -118,6 +118,22 @@ class TexelDensityTests(unittest.TestCase):
skin = report["slots"]["skin"]
self.assertEqual(skin["td_px_per_m"], skin["td_runtime_px_per_m"])
def test_every_character_reports_a_plausible_density_for_every_slot(self):
# Gate for the 3D review: a new or rebuilt character must keep all five
# tint slots measurable and inside the documented stylized band.
for name in ba.CHARACTERS:
report = ba.texel_density(name)
self.assertIsNotNone(report, name)
for slot in ba.SLOTS:
self.assertIn(slot, report["slots"], f"{name}:{slot}")
td = report["slots"][slot]["td_px_per_m"]
self.assertGreaterEqual(td, 40.0, f"{name}/{slot} below 40 px/m")
self.assertLessEqual(td, 400.0, f"{name}/{slot} above 400 px/m")
for slot in ba.TEXEL_RUNTIME_UV_SCALE:
if slot in report["slots"]:
self.assertGreaterEqual(report["slots"][slot]["td_runtime_px_per_m"],
250.0, f"{name}/{slot} fabric below 250 px/m")
def test_base_fallback_is_measurable_from_its_own_path(self):
from pathlib import Path
path = ba.ROOT / "assets" / "models" / "generated" / "npc_base.glb"
+56
View File
@@ -0,0 +1,56 @@
"""Keep the 3D model review scorecard honest.
Every catalogue asset (characters, gear, props) must have a row in
`docs/3d-model-review.md`, and the character rows must carry a verdict. This does
not judge the art; it only fails when an asset is added or renamed without being
reviewed, which is how a scorecard silently rots.
"""
import re
import unittest
from pathlib import Path
import blender_assets as model
ROOT = Path(__file__).resolve().parent.parent
REVIEW = ROOT / "docs" / "3d-model-review.md"
def catalogue_names() -> set[str]:
return set(model.CHARACTERS) | set(model.GEAR) | set(model.PROPS)
def reviewed_rows(text: str) -> dict[str, list[str]]:
"""Map asset name -> table cells for rows written as ``| `name` | ... |``."""
rows = {}
for line in text.splitlines():
match = re.match(r"^\| `([a-z0-9_]+)` \|(.*)\|\s*$", line)
if match:
rows[match.group(1)] = [cell.strip() for cell in match.group(2).split("|")]
return rows
class ModelReviewTests(unittest.TestCase):
def test_every_catalogue_asset_has_a_scorecard_row(self):
text = REVIEW.read_text(encoding="utf-8")
rows = reviewed_rows(text)
missing = sorted(catalogue_names() - set(rows))
self.assertEqual(missing, [], f"no scorecard row for: {', '.join(missing)}")
def test_character_rows_carry_a_verdict(self):
rows = reviewed_rows(REVIEW.read_text(encoding="utf-8"))
for character in model.CHARACTERS:
self.assertIn(character, rows, character)
verdict = rows[character][-1]
self.assertTrue(verdict, f"{character} has no verdict")
self.assertNotEqual(verdict, "—", f"{character} verdict not filled in")
def test_gear_and_prop_rows_have_a_verdict_column(self):
rows = reviewed_rows(REVIEW.read_text(encoding="utf-8"))
for prop in model.PROPS:
self.assertIn(prop, rows, prop)
self.assertTrue(rows[prop][-1], f"{prop} has no verdict column")
if __name__ == "__main__":
unittest.main()