particle library
This commit is contained in:
@@ -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