Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#nullable enable
using NUnit.Framework;

using io.github.hatayama.UnityCliLoop.FirstPartyTools;

namespace io.github.hatayama.UnityCliLoop.Tests.Editor
{
/// <summary>
/// Verifies missing Input System package warning text shared by first-party input tools.
/// </summary>
[TestFixture]
public sealed class InputSystemPackageRequirementMessageTests
{
[TestCase(
"simulate-keyboard",
"simulate-keyboard requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")]
[TestCase(
"simulate-mouse-input",
"simulate-mouse-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")]
[TestCase(
"record-input",
"record-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")]
[TestCase(
"replay-input",
"replay-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")]
public void Format_WithToolName_ReturnsExistingWarningMessage(string toolName, string expected)
{
// Verifies the shared formatter preserves the existing wire-visible warning text.
string result = InputSystemPackageRequirementMessage.Format(toolName);

Assert.That(result, Is.EqualTo(expected));
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#nullable enable
using System.Diagnostics;

namespace io.github.hatayama.UnityCliLoop.FirstPartyTools
{
/// <summary>
/// Formats the shared missing Input System package warning for first-party input tools.
/// </summary>
internal static class InputSystemPackageRequirementMessage
{
private const string MissingPackageRequirement =
"requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.";

public static string Format(string toolName)
{
Debug.Assert(!string.IsNullOrEmpty(toolName), "toolName must identify the CLI tool.");
return $"{toolName} {MissingPackageRequirement}";
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task<RecordInputResponse> RecordInputAsync(
return new RecordInputResponse
{
Success = false,
Message = "record-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.",
Message = InputSystemPackageRequirementMessage.Format("record-input"),
Action = request.Action.ToString()
};
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<ReplayInputResponse> ReplayInputAsync(
return new ReplayInputResponse
{
Success = false,
Message = "replay-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.",
Message = InputSystemPackageRequirementMessage.Format("replay-input"),
Action = request.Action.ToString()
};
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task<SimulateKeyboardResponse> ExecuteAsync(
return new SimulateKeyboardResponse
{
Success = false,
Message = "simulate-keyboard requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.",
Message = InputSystemPackageRequirementMessage.Format("simulate-keyboard"),
Action = parameters.Action.ToString()
};
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<SimulateMouseInputResponse> ExecuteAsync(
return new SimulateMouseInputResponse
{
Success = false,
Message = "simulate-mouse-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.",
Message = InputSystemPackageRequirementMessage.Format("simulate-mouse-input"),
Action = parameters.Action.ToString()
};
#else
Expand Down
Loading