Files
swiftcontrol/test/utils/keymap/controller_button_initials_test.dart
jonas.bark@gmx.de 33be7b8181 fix(keymap): show the number on generic gamepad buttons
The round button label kept only the first letter of each word, so every
generic gamepad button ("button-7") read "B" and every axis ("axis-1_-1")
read "A". Show "B7", "A1+" and "A1−" instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:37:49 +02:00

25 lines
1007 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('ControllerButton.initials', () {
test('multi-word camelCase → first letters, directions as arrows', () {
expect(const ControllerButton('sideButtonLeft').initials, 'SB←');
expect(const ControllerButton('navigationUp').initials, 'N↑');
expect(const ControllerButton('shiftDownRight').initials, 'S↓→');
});
test('single-word name → single uppercase letter', () {
expect(const ControllerButton('a').initials, 'A');
expect(const ControllerButton('paddleLeft').initials, 'P←');
});
test('generic gamepad keys keep their number', () {
expect(const ControllerButton('button-7').initials, 'B7');
expect(const ControllerButton('button-12').initials, 'B12');
expect(const ControllerButton('axis-1_1').initials, 'A1+');
expect(const ControllerButton('axis-1_-1').initials, 'A1−');
});
});
}