A renderer's roles: per-layer lighting is part of the look, and roleOf knows only real members

imageryLayer.lit (a layer shaded by the sun) joins the look with surface
shading. roleOf answers undefined for a member its port does not have, and
the port's own role without a member. The test now fails when two roles
claim the same entry.
This commit is contained in:
Sameh Khamis committed 2026-11-11 13:43:28 -08:00
1 parent 21fdc6a332
commit 46ad53aa35
3 files changed
+22 -7

No files matched your search

+6
View File
@@ -131,6 +131,9 @@ test('PORTS lists every member of every port, required exactly when the type req
test('every member of every port has one role, and each role names real members', () => {
const ids = ROLES.map((r) => r.id);
assert.equal(new Set(ids).size, ids.length);
// No entry is claimed by two roles, so the most specific entry is never a tie.
const entries = ROLES.flatMap((r) => r.members);
assert.equal(new Set(entries).size, entries.length, 'an entry in two roles');
for (const [port, members] of Object.entries(PORTS))
for (const member of Object.keys(members))
assert.ok(
@@ -156,6 +159,9 @@ test('every member of every port has one role, and each role names real members'
assert.equal(roleOf('globe', 'sky.set'), 'look');
assert.equal(roleOf('globe', 'setSurfaceShading'), 'look');
assert.equal(roleOf('nowhere', 'x'), undefined);
assert.equal(roleOf('globe', 'bogus'), undefined);
assert.equal(roleOf('globe'), 'surface');
assert.equal(roleOf('imageryLayer', 'lit'), 'look');
});
test('the capability and frame-step lists are the types’ own', () => {