diff options
author | Damien George <damien.p.george@gmail.com> | 2016-09-04 16:40:40 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-09-04 16:40:40 +1000 |
commit | 2d8740a4d11fbc4d147636e2161ec08eb46ecf66 (patch) | |
tree | e7e23614ba07af8e8a03f1c9df962adea8be8127 /tests/extmod/framebuf1.py | |
parent | 47899a1ab8756c3850bb275f3756544da0e7b050 (diff) | |
download | micropython-2d8740a4d11fbc4d147636e2161ec08eb46ecf66.tar.gz micropython-2d8740a4d11fbc4d147636e2161ec08eb46ecf66.zip |
tests/extmod: Add a test for framebuf module, tested by coverage build.
Diffstat (limited to 'tests/extmod/framebuf1.py')
-rw-r--r-- | tests/extmod/framebuf1.py | 35 |
1 files changed, 35 insertions, 0 deletions
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) |