tests/extmod: Improve modframebuf test coverage.

This commit is contained in:
Rami Ali 2016-12-13 15:47:58 +11:00 committed by Damien George
parent 0f408bc1ff
commit 9112b0b62b
3 changed files with 20 additions and 0 deletions

View File

@ -48,11 +48,21 @@ fbuf.fill(0)
fbuf.rect(1, 1, 3, 3, 1)
print('rect', buf)
#fill rect
fbuf.fill(0)
fbuf.fill_rect(1, 1, 3, 3, 1)
print('fill_rect', buf)
# line
fbuf.fill(0)
fbuf.line(1, 1, 3, 3, 1)
print('line', buf)
# line steep negative gradient
fbuf.fill(0)
fbuf.line(3, 3, 2, 1, 1)
print('line', buf)
# scroll
fbuf.fill(0)
fbuf.pixel(2, 7, 1)
@ -78,6 +88,12 @@ print(buf)
fbuf.text(str(chr(31)), 0, 0)
print(buf)
# test invalid constructor
try:
fbuf = framebuf.FrameBuffer(buf, w, h, 2, framebuf.MVLSB)
except ValueError:
print("ValueError")
# test legacy constructor
fbuf = framebuf.FrameBuffer1(buf, w, h)
fbuf = framebuf.FrameBuffer1(buf, w, h, w)

View File

@ -7,7 +7,9 @@ bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x00')
hline bytearray(b'\x02\x02\x02\x02\x02\x00\x00\x00\x00\x00')
vline bytearray(b'\x00\xff\x00\x00\x00\x00\xff\x00\x00\x00')
rect bytearray(b'\x00\x0e\n\x0e\x00\x00\x00\x00\x00\x00')
fill_rect bytearray(b'\x00\x0e\x0e\x0e\x00\x00\x00\x00\x00\x00')
line bytearray(b'\x00\x02\x04\x08\x00\x00\x00\x00\x00\x00')
line bytearray(b'\x00\x00\x06\x08\x00\x00\x00\x00\x00\x00')
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00')
bytearray(b'\x00\x00@\x00\x00\x00\x00\x00\x00\x00')
bytearray(b'\x00\x00\x00@\x00\x00\x00\x00\x00\x00')
@ -16,3 +18,4 @@ bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00')
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00')
ValueError

View File

@ -56,4 +56,5 @@ fbuf2.pixel(1, 2, 0xe00e)
fbuf.fill(0xffff)
fbuf.blit(fbuf2, 3, 3, 0x0000)
fbuf.blit(fbuf2, -1, -1, 0x0000)
fbuf.blit(fbuf2, 16, 16, 0x0000)
printbuf()