Files
swiftcontrol/test/utils/keymap/controller_button_initials_test.dart
Jonas Acker 2460ae3251 feat(zwift): split each Play/Ride paddle into inward and outward buttons
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>
2026-11-23 11:27:59 +01:00

25 lines
1000 B
Dart
Raw Permalink 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('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−');
});
});
}