mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-28 16:58:41 +01:00
paddleLeft/paddleRight become paddleLeftInward/Outward and paddleRightInward/Outward, each mappable on its own. Defaults are unchanged (left shifts down, right shifts up), and the built-in Zwift keymap maps both directions as the paddle was. The sign-to-direction mapping lives in one place, ZwiftPaddle in constants.dart, shared by the Play and Ride parsers, RideControllerPress and the emulator profiles. Inward = left positive / right negative, the sign BikeControl already sends Zwift to brake; not hardware-verified for reading paddles. Saved keymaps that name paddleLeft/paddleRight load onto both new buttons of that side, keeping action and device id; the next save writes the new names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1000 B
Dart
25 lines
1000 B
Dart
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('paddle').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−');
|
||
});
|
||
});
|
||
}
|