test(input-mapper): cover the ShowPadStatus action

Its default is F9 alone, it is keyboard-only (mouse buttons and the
wheel are errors), serializes and imports like the other utility
actions, warns when another action takes F9 until it moves off, and no
other built-in input uses F9.
This commit is contained in:
MarcZX10 authored and Adrià committed 2026-10-30 05:55:09 +01:00
1 parent 9df2079a1a
commit 7edaee9de3
1 file changed
+15
+15
View File
@@ -95,6 +95,21 @@ test('new utility actions import and round trip without accepting unsupported so
}
});
test('ShowPadStatus is a keyboard-only action with an F9 default that conflicts like any built-in', () => {
assert.deepEqual(defaults.ShowPadStatus, ['KEY:F9']);
assert.deepEqual(typesForAction('ShowPadStatus'), ['KEY']);
assert.equal(serialize([binding('ShowPadStatus', 'KEY', 'F4')]), 'ShowPadStatus = KEY:F4\n');
assert.equal(serialize([binding(' showpadstatus ', 'key', 'f9')]), 'ShowPadStatus = KEY:F9\n');
for (const [type, value] of [['MOUSE', 'Left'], ['MOUSE', 'X2'], ['WHEEL', 'Up'], ['WHEEL', 'Down']]) {
assert.ok(validate([binding('ShowPadStatus', type, value)]).errors.length, `${type}:${value}`);
}
assert.equal(validate([binding('ShowPadStatus', 'KEY', 'F4')]).warnings.length, 0);
const shared = validate([binding('TogglePerformanceOverlay', 'KEY', 'F9')]);
assert.ok(shared.warnings.some(warning => warning.message.includes('TogglePerformanceOverlay and ShowPadStatus (built-in)')));
assert.equal(validate([binding('TogglePerformanceOverlay', 'KEY', 'F9'), binding('ShowPadStatus', 'KEY', 'F4')]).warnings.length, 0);
assert.ok(Object.values(defaults).flat().filter(source => source === 'KEY:F9').length === 1);
});
test('updated built-in inputs warn until their owning action is overridden', () => {
for (const [action, type, value] of [['L2', 'KEY', 'R'], ['L2', 'MOUSE', 'X1'], ['ToggleMouse', 'KEY', 'F7'], ['Shake', 'KEY', 'X'], ['Screenshot', 'KEY', 'F12'], ['TogglePerformanceOverlay', 'KEY', 'F10'], ['ShowPadStatus', 'KEY', 'F9']]) {
const input = binding('Cross', type, value);