mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Add tests for i=0 in responses when no id specified
This commit is contained in:
@@ -180,9 +180,7 @@ def parse_osc_99(raw: str) -> NotificationCommand:
|
||||
actions = ','.join(x.name for x in Action)
|
||||
when = ','.join(x.name for x in OnlyWhen if x.value)
|
||||
urgency = ','.join(str(x.value) for x in Urgency)
|
||||
i = ''
|
||||
if cmd.identifier:
|
||||
i = f'i={sanitize_id(cmd.identifier)}:'
|
||||
i = f'i={sanitize_id(cmd.identifier or "0")}:'
|
||||
raise QueryResponse(f'99;{i}p=?;a={actions}:o={when}:u={urgency}')
|
||||
|
||||
if payload_type not in ('body', 'title'):
|
||||
|
||||
@@ -576,6 +576,13 @@ class TestParser(BaseTest):
|
||||
self.ae(activations, [('x', 1, True, False)])
|
||||
reset()
|
||||
|
||||
h('e=1;' + standard_b64encode(b'title').decode('ascii'))
|
||||
self.ae(notifications, [('title', '', 'i0', Urgency.Normal)])
|
||||
notification_activated(notifications[-1][-2], activated)
|
||||
self.ae(activations, [('0', 1, True, False)])
|
||||
reset()
|
||||
|
||||
|
||||
h('d=0:i=x:a=-report;title')
|
||||
h('d=1:i=x:a=report;body')
|
||||
self.ae(notifications, [('titlebody', '', 'i0', Urgency.Normal)])
|
||||
@@ -591,6 +598,10 @@ class TestParser(BaseTest):
|
||||
h('i=xyz:p=?')
|
||||
self.assertFalse(notifications)
|
||||
self.ae(query_responses, ['99;i=xyz:p=?;a=focus,report:o=always,unfocused,invisible:u=0,1,2'])
|
||||
reset()
|
||||
h('p=?')
|
||||
self.assertFalse(notifications)
|
||||
self.ae(query_responses, ['99;i=0:p=?;a=focus,report:o=always,unfocused,invisible:u=0,1,2'])
|
||||
|
||||
def test_dcs_codes(self):
|
||||
s = self.create_screen()
|
||||
|
||||
Reference in New Issue
Block a user