summaryrefslogtreecommitdiff
path: root/src/SMAPI/Utilities/Keybind.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-20 01:02:49 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-20 01:02:49 -0500
commit587d60495e01b1bdacc31acc7e15a87d7f441839 (patch)
treedf43368ad1308fc7a3f2f290d4f08f2349775795 /src/SMAPI/Utilities/Keybind.cs
parente40483aab1f6dbcb89f3a1fd1639fc732fe987fc (diff)
downloadSMAPI-587d60495e01b1bdacc31acc7e15a87d7f441839.tar.gz
SMAPI-587d60495e01b1bdacc31acc7e15a87d7f441839.tar.bz2
SMAPI-587d60495e01b1bdacc31acc7e15a87d7f441839.zip
add unit tests for KeybindList (#744)
Diffstat (limited to 'src/SMAPI/Utilities/Keybind.cs')
-rw-r--r--src/SMAPI/Utilities/Keybind.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/SMAPI/Utilities/Keybind.cs b/src/SMAPI/Utilities/Keybind.cs
index 9d6cd6ee..dd8d2861 100644
--- a/src/SMAPI/Utilities/Keybind.cs
+++ b/src/SMAPI/Utilities/Keybind.cs
@@ -10,6 +10,14 @@ namespace StardewModdingAPI.Utilities
public class Keybind
{
/*********
+ ** Fields
+ *********/
+ /// <summary>Get the current input state for a button.</summary>
+ [Obsolete("This property should only be used for unit tests.")]
+ internal Func<SButton, SButtonState> GetButtonState { get; set; } = SGame.GetInputState;
+
+
+ /*********
** Accessors
*********/
/// <summary>The buttons that must be down to activate the keybind.</summary>
@@ -97,7 +105,7 @@ namespace StardewModdingAPI.Utilities
/// <summary>Get the keybind state relative to the previous tick.</summary>
public SButtonState GetState()
{
- SButtonState[] states = this.Buttons.Select(SGame.GetInputState).Distinct().ToArray();
+ SButtonState[] states = this.Buttons.Select(this.GetButtonState).Distinct().ToArray();
// single state
if (states.Length == 1)