tweak
This commit is contained in:
@@ -7,12 +7,13 @@ const vm = require('node:vm');
|
||||
function variantBuilder() {
|
||||
const source = fs.readFileSync(path.join(__dirname, '..', 'AnimationDirector.js'), 'utf8').replace(
|
||||
' Plugin.register(PLUGIN_ID, {',
|
||||
' globalThis.variantTest = { buildGenderModelVariant, refreshModelVariantFields, createModelVariantBoneSections, buildJemModelVariant };\n Plugin.register(PLUGIN_ID, {'
|
||||
' globalThis.variantTest = { buildGenderModelVariant, refreshModelVariantFields, createModelVariantBoneSections, buildJemModelVariant, normalizeGeckoExportName };\n Plugin.register(PLUGIN_ID, {'
|
||||
);
|
||||
const context = { Plugin: { register() {} }, console };
|
||||
vm.runInNewContext(source, context);
|
||||
return Object.assign(context.variantTest.buildGenderModelVariant, { refresh: context.variantTest.refreshModelVariantFields,
|
||||
sections: context.variantTest.createModelVariantBoneSections, jem: context.variantTest.buildJemModelVariant });
|
||||
sections: context.variantTest.createModelVariantBoneSections, jem: context.variantTest.buildJemModelVariant,
|
||||
normalizeName: context.variantTest.normalizeGeckoExportName });
|
||||
}
|
||||
|
||||
test('gender variants omit selected bones, descendants, locators and texture overrides without changing source', () => {
|
||||
@@ -35,6 +36,15 @@ test('gender variants omit selected bones, descendants, locators and texture ove
|
||||
assert.equal(JSON.stringify(source), before);
|
||||
});
|
||||
|
||||
test('GeckoLib export filenames strip repeated geo and project extensions', () => {
|
||||
const normalize = variantBuilder().normalizeName;
|
||||
for (const name of ['horse', 'horse.geo', 'horse.geo.geo', 'horse.geo.json', 'horse.geo.bbench', 'horse.geo.bbmodel']) {
|
||||
assert.equal(normalize(name), 'horse');
|
||||
}
|
||||
assert.equal(normalize('horse.f.geo.geo.json'), 'horse.f');
|
||||
assert.equal(normalize('geology'), 'geology');
|
||||
});
|
||||
|
||||
test('variant subtree propagation handles nested children and unknown saved selections', () => {
|
||||
const build = variantBuilder();
|
||||
const source = { 'minecraft:geometry': [{ bones: [
|
||||
|
||||
Reference in New Issue
Block a user