logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class HidOutputReportSizeTests

    EditMode tests for Serenity.InputGateway.Infrastructure.Devices.Motion.HidOutputReportSize: pins the fallback behaviour both DualSenseGamepadHIDWithMotion and DualShock4GamepadHIDWithMotion relied on before this logic was extracted — table-driven over each pad's own fallback size (48 for DualSense, 32 for DualShock 4) so a regression in either device's wiring would show up here. Covers both of UnityEngine.InputSystem.HID.HID.HIDDeviceDescriptor.FromJson(System.String)'s parse paths: the minimal single-field JSON below only satisfies its whitespace-free, exactly-ordered predictive parser by accident of key count, so it actually falls through to the JsonUtility fallback parser (see Resolve_CapabilitiesWithPositiveOutputReportSize_ReturnsDescriptorSize(int)); Resolve_FullyOrderedDescriptorJson_ReturnsDescriptorSizeViaPredictiveParser() proves the predictive parser itself with a complete, correctly-ordered descriptor.

    Inheritance
    object
    HidOutputReportSizeTests
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.InputGateway.Infrastructure.Devices.Motion.Tests
    Assembly: Serenity.PlayerInput.Tests.Editor.dll
    Syntax
    public sealed class HidOutputReportSizeTests

    Constructors

    HidOutputReportSizeTests()

    Declaration
    public HidOutputReportSizeTests()

    Methods

    Resolve_CapabilitiesWithPositiveOutputReportSize_ReturnsDescriptorSize(int)

    Exercises the JsonUtility fallback path only: the leading space after { breaks HIDDeviceDescriptor.FromJson's whitespace-free predictive parser at its very first token, so it always falls back before reaching this field.

    Declaration
    public void Resolve_CapabilitiesWithPositiveOutputReportSize_ReturnsDescriptorSize(int fallbackSize)
    Parameters
    Type Name Description
    int fallbackSize

    Resolve_CapabilitiesWithZeroOutputReportSize_ReturnsFallback(int)

    Declaration
    public void Resolve_CapabilitiesWithZeroOutputReportSize_ReturnsFallback(int fallbackSize)
    Parameters
    Type Name Description
    int fallbackSize

    Resolve_EmptyCapabilities_ReturnsFallback(int)

    Declaration
    public void Resolve_EmptyCapabilities_ReturnsFallback(int fallbackSize)
    Parameters
    Type Name Description
    int fallbackSize

    Resolve_FullyOrderedDescriptorJson_ReturnsDescriptorSizeViaPredictiveParser()

    Exercises the predictive parser path: a complete descriptor with every field in HIDDeviceDescriptor.FromJson's expected order (vendorId, productId, usage, usagePage, inputReportSize, outputReportSize, featureReportSize) and no whitespace, which is exactly what that parser requires to succeed instead of throwing and falling back to JsonUtility.

    Declaration
    public void Resolve_FullyOrderedDescriptorJson_ReturnsDescriptorSizeViaPredictiveParser()

    Resolve_NullCapabilities_ReturnsFallback(int)

    Declaration
    public void Resolve_NullCapabilities_ReturnsFallback(int fallbackSize)
    Parameters
    Type Name Description
    int fallbackSize
    In this article
    © 2026 Serenity. All Rights Reserved