summaryrefslogtreecommitdiff
path: root/tests/extmod/framebuf1.py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@chickadee.tech>2016-09-19 13:32:29 -0700
committerScott Shawcroft <scott@chickadee.tech>2016-09-19 13:32:29 -0700
commitbb03afdb77c95b9cb23e531e5763167ccb09c8e4 (patch)
tree509722778a03b10c933963a35c93eb5670a5cdb5 /tests/extmod/framebuf1.py
parent345dd1484c4e68f53ea242c5778a2de99119db9a (diff)
parent60592fd23c8acd4ed4f70d8fbe8f8b11ea58082c (diff)
Merge remote-tracking branch 'micropython/master'
Diffstat (limited to 'tests/extmod/framebuf1.py')
-rw-r--r--tests/extmod/framebuf1.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py
new file mode 100644
index 000000000..f550b6b4f
--- /dev/null
+++ b/tests/extmod/framebuf1.py
@@ -0,0 +1,41 @@
+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)
+fbuf.scroll(1, 0)
+print(buf)
+fbuf.scroll(-1, 0)
+print(buf)
+fbuf.scroll(2, 2)
+print(buf)