Formatting, tidying up, add extra mouse event parsing test

This commit is contained in:
Darren Burns
2022-06-10 09:51:59 +01:00
parent 0125fbdd4f
commit 30b6a0b50d
2 changed files with 21 additions and 7 deletions

View File

@@ -3,8 +3,15 @@ from unittest import mock
import pytest
from textual._xterm_parser import XTermParser
from textual.events import Paste, Key, MouseDown, MouseUp, MouseMove, MouseScrollDown, \
MouseScrollUp
from textual.events import (
Paste,
Key,
MouseDown,
MouseUp,
MouseMove,
MouseScrollDown,
MouseScrollUp,
)
from textual.messages import TerminalSupportsSynchronizedOutput
@@ -207,6 +214,13 @@ def test_mouse_scroll_up(parser, sequence, shift, meta):
assert event.y == 24
def test_mouse_event_detected_but_info_not_parsed(parser):
# I don't know if this can actually happen in reality, but
# there's a branch in the code that allows for the possibility.
events = list(parser.feed("\x1b[<65;18;20;25M"))
assert len(events) == 0
def test_escape_sequence_resulting_in_multiple_keypresses(parser):
"""Some sequences are interpreted as more than 1 keypress"""
events = list(parser.feed("\x1b[2;4~"))