Skip to content

Commit 9112b0b

Browse files
flowergrassdpgeorge
authored andcommitted
tests/extmod: Improve modframebuf test coverage.
1 parent 0f408bc commit 9112b0b

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

tests/extmod/framebuf1.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,21 @@
4848
fbuf.rect(1, 1, 3, 3, 1)
4949
print('rect', buf)
5050

51+
#fill rect
52+
fbuf.fill(0)
53+
fbuf.fill_rect(1, 1, 3, 3, 1)
54+
print('fill_rect', buf)
55+
5156
# line
5257
fbuf.fill(0)
5358
fbuf.line(1, 1, 3, 3, 1)
5459
print('line', buf)
5560

61+
# line steep negative gradient
62+
fbuf.fill(0)
63+
fbuf.line(3, 3, 2, 1, 1)
64+
print('line', buf)
65+
5666
# scroll
5767
fbuf.fill(0)
5868
fbuf.pixel(2, 7, 1)
@@ -78,6 +88,12 @@
7888
fbuf.text(str(chr(31)), 0, 0)
7989
print(buf)
8090

91+
# test invalid constructor
92+
try:
93+
fbuf = framebuf.FrameBuffer(buf, w, h, 2, framebuf.MVLSB)
94+
except ValueError:
95+
print("ValueError")
96+
8197
# test legacy constructor
8298
fbuf = framebuf.FrameBuffer1(buf, w, h)
8399
fbuf = framebuf.FrameBuffer1(buf, w, h, w)

tests/extmod/framebuf1.py.exp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x00')
77
hline bytearray(b'\x02\x02\x02\x02\x02\x00\x00\x00\x00\x00')
88
vline bytearray(b'\x00\xff\x00\x00\x00\x00\xff\x00\x00\x00')
99
rect bytearray(b'\x00\x0e\n\x0e\x00\x00\x00\x00\x00\x00')
10+
fill_rect bytearray(b'\x00\x0e\x0e\x0e\x00\x00\x00\x00\x00\x00')
1011
line bytearray(b'\x00\x02\x04\x08\x00\x00\x00\x00\x00\x00')
12+
line bytearray(b'\x00\x00\x06\x08\x00\x00\x00\x00\x00\x00')
1113
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00')
1214
bytearray(b'\x00\x00@\x00\x00\x00\x00\x00\x00\x00')
1315
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')
1618
bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00')
1719
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
1820
bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00')
21+
ValueError

tests/extmod/framebuf16.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ def printbuf():
5656
fbuf.fill(0xffff)
5757
fbuf.blit(fbuf2, 3, 3, 0x0000)
5858
fbuf.blit(fbuf2, -1, -1, 0x0000)
59+
fbuf.blit(fbuf2, 16, 16, 0x0000)
5960
printbuf()

0 commit comments

Comments
 (0)