particle library
This commit is contained in:
@@ -137,7 +137,7 @@ test('desktop-only tools are visible in desktop Blockbench and hidden in browser
|
||||
const h = harness(); h.context.registration.onload();
|
||||
const actions = h.menus.flatMap((menu) => menu.children).filter((action) => action && typeof action !== 'string');
|
||||
const ids = ['animationdirector_automatic_import', 'animationdirector_pack_folders', 'animationdirector_item_props',
|
||||
'animationdirector_sound_library', 'animationdirector_create_jem_model'];
|
||||
'animationdirector_sound_library', 'animationdirector_particle_library', 'animationdirector_create_jem_model'];
|
||||
for (const id of ids) {
|
||||
const action = actions.find((entry) => entry.id === id);
|
||||
assert.ok(action, `${id} is registered`);
|
||||
@@ -155,7 +155,7 @@ test('animation menu orders import and creation actions and has no deprecated sp
|
||||
assert.deepEqual(Array.from(menu.children, (action) => action === '_' ? '_' : action.name), [
|
||||
'Import Whole Animation', 'Import Actor', 'Import Animation', 'Import Animation Definition', 'Pack Folders',
|
||||
'_', 'Actor Preferences', 'Replace Actor Model',
|
||||
'_', 'Block Requirements', 'Item Props', 'NoN Sound Library',
|
||||
'_', 'Block Requirements', 'Item Props', 'NoN Sound Library', 'NoN Particle Library',
|
||||
'_', 'Animation Definition', 'Export Animations',
|
||||
]);
|
||||
const source = fs.readFileSync(path.join(__dirname, '..', 'AnimationDirector.js'), 'utf8');
|
||||
|
||||
@@ -11,7 +11,7 @@ function harness() {
|
||||
.replace(' Plugin.register(PLUGIN_ID, {', `
|
||||
globalThis.api = { loadSoundLibrary, resolveSoundAudio, mapAnimationSounds,
|
||||
applyLibrarySound, compileConjoinedStage, showSoundLibrary, SOUND_SOURCE_KEY, SOUND_PREVIEW_PROPERTY,
|
||||
installFiguraSoundCompat, beginFiguraSoundPlayback, removeFiguraSoundCompat, isBrokenFiguraSoundWrapper };
|
||||
installFiguraSoundCompat, beginFiguraSoundPlayback, removeFiguraSoundCompat, isBrokenFiguraSoundWrapper, refreshSoundLibraryPanel };
|
||||
Plugin.register(PLUGIN_ID, {`);
|
||||
class EffectAnimator {
|
||||
constructor(animation) { this.animation = animation; this.sound = []; }
|
||||
@@ -69,6 +69,33 @@ function assets(t, json, files = {}) {
|
||||
return root;
|
||||
}
|
||||
|
||||
test('keyframe sound library button only appears for sound selections', () => {
|
||||
const h = harness(), elements = new Map();
|
||||
const id = 'animationdirector_sound_library_button';
|
||||
elements.set('panel_keyframe', { appendChild(button) { elements.set(button.id, button); } });
|
||||
h.context.Blockbench = { isWeb: false };
|
||||
h.context.document = {
|
||||
getElementById(id) { return elements.get(id); },
|
||||
createElement() { return { style: {}, addEventListener() {}, remove() { elements.delete(this.id); } }; },
|
||||
};
|
||||
for (const channel of ['particle', 'rotation', null, 'sound', 'particle', 'sound']) {
|
||||
h.context.Timeline.selected = channel ? [{ channel }] : [];
|
||||
h.refreshSoundLibraryPanel();
|
||||
assert.equal(elements.has(id), channel === 'sound', `Button visibility for ${channel}`);
|
||||
}
|
||||
h.context.Timeline.selected.push({ channel: 'particle' });
|
||||
h.refreshSoundLibraryPanel();
|
||||
assert.equal(elements.has(id), false, 'Mixed selections do not show sound-only controls');
|
||||
h.context.Timeline.selected = [{ channel: 'sound' }];
|
||||
h.refreshSoundLibraryPanel();
|
||||
const first = elements.get(id);
|
||||
h.refreshSoundLibraryPanel();
|
||||
assert.equal(elements.get(id), first, 'Refreshing does not duplicate the button');
|
||||
h.context.Blockbench.isWeb = true;
|
||||
h.refreshSoundLibraryPanel();
|
||||
assert.equal(elements.has(id), false, 'Desktop-only controls remain hidden in browsers');
|
||||
});
|
||||
|
||||
test('sound library reads the real NoN sound registry, lazily maps semantic cues and caches audio', () => {
|
||||
const h = harness();
|
||||
h.storage.set(h.SOUND_SOURCE_KEY, path.resolve(__dirname, '../../NON/src/main/resources'));
|
||||
|
||||
Reference in New Issue
Block a user