Add tests for AxisToButton rule. (WIP)
This commit is contained in:
parent
47fac539da
commit
e93187b8a5
4 changed files with 76 additions and 14 deletions
|
@ -8,8 +8,6 @@ import (
|
|||
|
||||
// MappingRuleAxisToButton represents a rule that converts an axis input into a (potentially repeating)
|
||||
// button output.
|
||||
//
|
||||
// TODO: Add Tests
|
||||
type MappingRuleAxisToButton struct {
|
||||
MappingRuleBase
|
||||
Input *RuleTargetAxis
|
||||
|
@ -38,9 +36,8 @@ func NewMappingRuleAxisToButton(base MappingRuleBase, input *RuleTargetAxis, out
|
|||
}
|
||||
}
|
||||
|
||||
func (rule *MappingRuleAxisToButton) MatchEvent(device *evdev.InputDevice, event *evdev.InputEvent, mode *string) (*evdev.InputDevice, *evdev.InputEvent) {
|
||||
// TODO: we're using this instead of the RuleTarget's MatchEvent because we need to check inside the deadzone
|
||||
// We should find a cleaner way to do this...
|
||||
func (rule *MappingRuleAxisToButton) MatchEvent(device RuleTargetDevice, event *evdev.InputEvent, mode *string) (*evdev.InputDevice, *evdev.InputEvent) {
|
||||
|
||||
if !rule.MappingRuleBase.modeCheck(mode) ||
|
||||
!rule.Input.MatchEventDeviceAndCode(device, event) {
|
||||
return nil, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue