diff --git a/tests/test_command_routing.py b/tests/test_command_routing.py index b1b3b33..eece6a9 100644 --- a/tests/test_command_routing.py +++ b/tests/test_command_routing.py @@ -724,6 +724,37 @@ class TestAdbCommandService: assert not player.hass.services.has_service("nvidia_shield", "adb_command") +class TestChannelDigitDelayConsumed: + """t26 F3: a non-default digit delay reaches the sequence's sleep.""" + + async def test_non_default_delay_reaches_the_sequence_sleep(self, modules): + import asyncio + + player, _s = _ladder_player(modules) + player._entry.options["channel_digit_delay"] = 0.3 # non-default + + sleeps: list[float] = [] + real_sleep = asyncio.sleep + + mp_module = sys.modules["nsh.media_player"] + real_module_sleep = mp_module.asyncio.sleep + + async def spying_sleep(delay, *args): + sleeps.append(delay) + await real_sleep(0) + + mp_module.asyncio.sleep = spying_sleep + try: + await player.async_play_media("channel", "123") + if player._channel_task is not None: + await player._channel_task # the sequence runs to completion + finally: + mp_module.asyncio.sleep = real_module_sleep + + # three digits → three sleeps, each with the option's 0.3 s + assert sleeps == [0.3, 0.3, 0.3] + + class TestTextEntry: """P5-2: text entry — protocol IME first, ADB input-text fallback."""