mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-14 12:29:15 +00:00
TST: Add a test to check that assets don't block themselves
This commit is contained in:
parent
d513a867d7
commit
8313c56a5c
1 changed files with 25 additions and 0 deletions
|
@ -1279,6 +1279,30 @@ function testDrawCallbacks(assets, window) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {readonly Asset[]} assets
|
||||
* @param {Record<ExtendedArchetype, Record<string, AssetArchetypeData>>} extendedDataRecords
|
||||
*/
|
||||
function testSelfBlock(assets, extendedDataRecords) {
|
||||
for (const asset of assets) {
|
||||
/** @type {readonly AssetGroupName[]} */
|
||||
const blocks = asset.Block ?? [];
|
||||
if (blocks.includes(asset.Group.Name)) {
|
||||
error(`${asset.Group.Name}:${asset.Name}: item must not block its own group`);
|
||||
}
|
||||
|
||||
/** @type {Record<string, ExtendedItemOption[]>} */
|
||||
const extendedOptions = getExtendedOptions(asset, extendedDataRecords);
|
||||
for (const [extendedName, options] of Object.entries(extendedOptions)) {
|
||||
/** @type {readonly AssetGroupName[]} */
|
||||
const extendedBlocks = options.flatMap(o => o.Property?.Block ?? []);
|
||||
if (extendedBlocks.includes(asset.Group.Name)) {
|
||||
error(`${asset.Group.Name}:${asset.Name}:${extendedName} extended item must not block its own group`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strigify and parse the passed object to get the correct Array and Object prototypes, because VM uses different ones.
|
||||
* This unfortunately results in Functions being lost and replaced with a dummy function
|
||||
|
@ -1512,4 +1536,5 @@ function sanitizeVMOutput(input) {
|
|||
testHasPreview(assetList);
|
||||
testAssetHasPNG(assetList, extendedItemSuperRecord, poseRecord);
|
||||
testSetPose(assetList, pose);
|
||||
testSelfBlock(assetList, extendedItemSuperRecord);
|
||||
})();
|
||||
|
|
Loading…
Add table
Reference in a new issue