From 27e5bfb21627c73b53623c5ccbf93841a221bfb2 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 7 Nov 2026 12:23:51 +0100 Subject: island: shuffle and repeat as two Sonix buttons The one mode button cycled all five SonixLink modes and showed repeat-off as its first state, so shuffle looked missing. Shuffle is now a toggle on the left and repeat a cycle on the right. SonixLink has no shuffle with repeat one, so with shuffle on repeat goes off and all only. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/sonix/test_sonix.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'desktop/modules/sonix/test_sonix.js') diff --git a/desktop/modules/sonix/test_sonix.js b/desktop/modules/sonix/test_sonix.js index 32da061..7847e41 100644 --- a/desktop/modules/sonix/test_sonix.js +++ b/desktop/modules/sonix/test_sonix.js @@ -19,7 +19,7 @@ const assert = require("assert"); const src = fs.readFileSync(__dirname + "/Sonix.js", "utf8") .replace(/^\.pragma library$/m, ""); const S = new Function(src + - "\nreturn { parseBeacon, qualityLine, nextMode, modeGlyph, clock, cover, centred, zoomAt," + + "\nreturn { parseBeacon, qualityLine, toggleShuffle, nextRepeat, shuffleGlyph, repeatGlyph, clock, cover, centred, zoomAt," + " stamp, query, crumbs, parentOf, colour, offsetXY };")(); // Beacon: "SONIXLINK1 ". @@ -38,11 +38,24 @@ assert.strictEqual(S.qualityLine({ path: "x.mp3", sample_rate: 44100, bits: 0, b assert.strictEqual(S.qualityLine({ path: "", sample_rate: 0, bits: 0, bitrate: 0 }), ""); // Mode cycle, unknown restarts at normal. -assert.strictEqual(S.nextMode("normal"), "repeat_all"); -assert.strictEqual(S.nextMode("shuffle_repeat"), "normal"); -assert.strictEqual(S.nextMode("???"), "normal"); -assert.strictEqual(S.modeGlyph("repeat_one"), 0xF0458); -assert.strictEqual(S.modeGlyph("???"), 0xF0457); +// Shuffle and repeat as two buttons over SonixLink's five modes. +assert.strictEqual(S.toggleShuffle("normal"), "shuffle"); +assert.strictEqual(S.toggleShuffle("repeat_all"), "shuffle_repeat"); +assert.strictEqual(S.toggleShuffle("repeat_one"), "shuffle"); +assert.strictEqual(S.toggleShuffle("shuffle"), "normal"); +assert.strictEqual(S.toggleShuffle("shuffle_repeat"), "repeat_all"); +assert.strictEqual(S.toggleShuffle("???"), "shuffle"); +assert.strictEqual(S.nextRepeat("normal"), "repeat_all"); +assert.strictEqual(S.nextRepeat("repeat_all"), "repeat_one"); +assert.strictEqual(S.nextRepeat("repeat_one"), "normal"); +assert.strictEqual(S.nextRepeat("shuffle"), "shuffle_repeat"); +assert.strictEqual(S.nextRepeat("shuffle_repeat"), "shuffle"); +assert.strictEqual(S.nextRepeat("???"), "repeat_all"); +assert.strictEqual(S.shuffleGlyph("shuffle_repeat"), 0xF049D); +assert.strictEqual(S.shuffleGlyph("repeat_one"), 0xF049E); +assert.strictEqual(S.repeatGlyph("repeat_one"), 0xF0458); +assert.strictEqual(S.repeatGlyph("shuffle_repeat"), 0xF0456); +assert.strictEqual(S.repeatGlyph("shuffle"), 0xF0457); assert.strictEqual(S.clock(0), "0:00"); assert.strictEqual(S.clock(61.9), "1:01"); -- cgit v1.2.3