修 id 解析

This commit is contained in:
2026-08-01 14:15:13 +02:00
parent 130f8b4c1d
commit 656fab349d
8 changed files with 293 additions and 13 deletions
+30
View File
@@ -17,6 +17,36 @@ test("GameObject has expected attributes", () => {
assert.ok(attrs.some((a) => a.name === "inheritFrom"));
});
test("attribute-level xas:refType is captured (module ids, map objects)", () => {
// ModuleData@id is declared as <xs:attribute name="id" type="Poid"
// xas:refType="ModuleData" />; the refType must reach every module subtype.
const moduleId = model.attributesOfType("ModuleData").find((a) => a.name === "id");
assert.equal(moduleId?.refType, "ModuleData");
assert.equal(
model.attributesOfType("W3DTruckDrawModuleData").find((a) => a.name === "id")?.refType,
"ModuleData",
);
// MapObject@id declares itself; ThingTemplate references a GameObject.
assert.equal(
model.attributesOfType("MapObject").find((a) => a.name === "id")?.refType,
"MapObject",
);
assert.equal(
model.attributesOfType("MapObject").find((a) => a.name === "ThingTemplate")?.refType,
"GameObject",
);
// RoadObject@id references a different global asset type (Road).
assert.equal(
model.attributesOfType("RoadObject").find((a) => a.name === "id")?.refType,
"Road",
);
// Poid pipeline-local references keep their typed targets.
assert.equal(
model.attributesOfType("AttachNugget").find((a) => a.name === "AttachModuleId")?.refType,
"ModuleData",
);
});
test("Include has reference/instance/all enum", () => {
const attrs = model.attributesOfElement("Include");
const type = attrs.find((a) => a.name === "type");