Fix deletion with image numbers

This commit is contained in:
Kovid Goyal
2020-12-16 18:57:46 +05:30
parent 2fd6bf7442
commit e82a6dedd9
4 changed files with 37 additions and 18 deletions

View File

@@ -231,7 +231,7 @@ class TestGraphics(BaseTest):
# test error handling for loading bad png data
self.assertRaisesRegex(ValueError, '[EBADPNG]', load_png_data, b'dsfsdfsfsfd')
def test_load_with_numbers(self):
def test_gr_operations_with_numbers(self):
s = self.create_screen()
g = s.grman
@@ -280,6 +280,24 @@ class TestGraphics(BaseTest):
code, idstr = put(c=2, r=2, I=94)
self.ae(code, 'ENOENT')
# test delete with number
def delete(ac='N', **kw):
cmd = 'a=d'
if ac:
cmd += ',d={}'.format(ac)
if kw:
cmd += ',' + ','.join('{}={}'.format(k, v) for k, v in kw.items())
send_command(s, cmd)
count = s.grman.image_count
put(i=1), put(i=2), put(i=3), put(i=4), put(i=5)
delete(I=94)
self.ae(s.grman.image_count, count)
delete(I=93)
self.ae(s.grman.image_count, count - 1)
delete(I=1)
self.ae(s.grman.image_count, count - 2)
def test_image_put(self):
cw, ch = 10, 20
s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch)