diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py new file mode 100644 index 0000000000..85555d0d2c --- /dev/null +++ b/tests/extmod/framebuf1.py @@ -0,0 +1,35 @@ +try: + import framebuf +except ImportError: + print("SKIP") + import sys + sys.exit() + +w = 5 +h = 16 +buf = bytearray(w * h // 8) +fbuf = framebuf.FrameBuffer1(buf, w, h, w) + +# fill +fbuf.fill(1) +print(buf) +fbuf.fill(0) +print(buf) + +# put pixel +fbuf.pixel(0, 0, 1) +fbuf.pixel(4, 0, 1) +fbuf.pixel(0, 15, 1) +fbuf.pixel(4, 15, 1) +print(buf) + +# get pixel +print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) + +# scroll +fbuf.fill(0) +fbuf.pixel(2, 7, 1) +fbuf.scroll(0, 1) +print(buf) +fbuf.scroll(0, -2) +print(buf) diff --git a/tests/extmod/framebuf1.py.exp b/tests/extmod/framebuf1.py.exp new file mode 100644 index 0000000000..5aca194614 --- /dev/null +++ b/tests/extmod/framebuf1.py.exp @@ -0,0 +1,6 @@ +bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x80') +1 0 +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00') +bytearray(b'\x00\x00@\x00\x00\x00\x00\x00\x00\x00') diff --git a/unix/mpconfigport_coverage.h b/unix/mpconfigport_coverage.h index f9a6fbd9dd..5fd5b82c1b 100644 --- a/unix/mpconfigport_coverage.h +++ b/unix/mpconfigport_coverage.h @@ -35,3 +35,4 @@ #undef MICROPY_VFS_FAT #define MICROPY_FSUSERMOUNT (1) #define MICROPY_VFS_FAT (1) +#define MICROPY_PY_FRAMEBUF (1)