< Summary

Class:GDX.Developer.ConsoleCommands.InputKeyPressConsoleCommand
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/InputKeyPressConsoleCommand.cs
Covered lines:3
Uncovered lines:21
Coverable lines:24
Total lines:60
Line coverage:12.5% (3 of 24)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:6
Method coverage:16.6% (1 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Evaluate(...)0%2100%
GetAccessLevel()0%2100%
GetKeyword()0%110100%
GetHelpUsage()0%2100%
GetHelpMessage()0%2100%
GetInstance(...)0%6200%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/InputKeyPressConsoleCommand.cs

#LineLine coverage
 1// Copyright (c) 2020-2022 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5
 6namespace GDX.Developer.ConsoleCommands
 7{
 8#if UNITY_2022_2_OR_NEWER
 9    public class InputKeyPressConsoleCommand : ConsoleCommandBase
 10    {
 11        InputProxy.KeyCode m_KeyCode;
 12
 13        /// <inheritdoc />
 14        public override bool Evaluate(float deltaTime)
 015        {
 016            InputProxy.KeyPress(m_KeyCode);
 017            return true;
 018        }
 19
 20        /// <inheritdoc />
 21        public override Console.ConsoleAccessLevel GetAccessLevel()
 022        {
 023            return Console.ConsoleAccessLevel.Developer;
 024        }
 25
 26        /// <inheritdoc />
 27        public override string GetKeyword()
 728        {
 729            return "input.keypress";
 730        }
 31
 32        /// <inheritdoc />
 33        public override string GetHelpUsage()
 034        {
 035            return "input.keypress <name>";
 036        }
 37
 38        /// <inheritdoc />
 39        public override string GetHelpMessage()
 040        {
 041            return
 42                "Synthesize the down and up event for a designated keyboard key. See https://learn.microsoft.com/en-us/w
 043        }
 44
 45        /// <inheritdoc />
 46        public override ConsoleCommandBase GetInstance(string context)
 047        {
 048            InputKeyPressConsoleCommand command =
 49                new InputKeyPressConsoleCommand { m_KeyCode = InputProxy.GetKeyCode(context) };
 050            if (command.m_KeyCode != InputProxy.KeyCode.Invalid)
 051            {
 052                return command;
 53            }
 54
 055            UnityEngine.Debug.LogWarning($"Unable to parse key from '{context}'.");
 056            return null;
 057        }
 58    }
 59#endif // UNITY_2022_2_OR_NEWER
 60}

Coverage by test methods







Methods/Properties

Evaluate(System.Single)
GetAccessLevel()
GetKeyword()
GetHelpUsage()
GetHelpMessage()
GetInstance(System.String)