summaryrefslogtreecommitdiff
path: root/tests/extmod/framebuf16.py
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2020-03-22 21:26:08 -0500
committerDamien George <damien.p.george@gmail.com>2020-03-30 13:21:58 +1100
commit3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch)
tree94ff44f8eabba0039582c245b901173597edd11e /tests/extmod/framebuf16.py
parent488613bca6c460340ed2995ae5cafafe22d0bfff (diff)
tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
Diffstat (limited to 'tests/extmod/framebuf16.py')
-rw-r--r--tests/extmod/framebuf16.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/extmod/framebuf16.py b/tests/extmod/framebuf16.py
index fe81f7f93..e658f1345 100644
--- a/tests/extmod/framebuf16.py
+++ b/tests/extmod/framebuf16.py
@@ -4,28 +4,30 @@ except ImportError:
print("SKIP")
raise SystemExit
+
def printbuf():
print("--8<--")
for y in range(h):
- print(buf[y * w * 2:(y + 1) * w * 2])
+ print(buf[y * w * 2 : (y + 1) * w * 2])
print("-->8--")
+
w = 4
h = 5
buf = bytearray(w * h * 2)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565)
# fill
-fbuf.fill(0xffff)
+fbuf.fill(0xFFFF)
printbuf()
fbuf.fill(0x0000)
printbuf()
# put pixel
-fbuf.pixel(0, 0, 0xeeee)
-fbuf.pixel(3, 0, 0xee00)
-fbuf.pixel(0, 4, 0x00ee)
-fbuf.pixel(3, 4, 0x0ee0)
+fbuf.pixel(0, 0, 0xEEEE)
+fbuf.pixel(3, 0, 0xEE00)
+fbuf.pixel(0, 4, 0x00EE)
+fbuf.pixel(3, 4, 0x0EE0)
printbuf()
# get pixel
@@ -33,7 +35,7 @@ print(fbuf.pixel(0, 4), fbuf.pixel(1, 1))
# scroll
fbuf.fill(0x0000)
-fbuf.pixel(2, 2, 0xffff)
+fbuf.pixel(2, 2, 0xFFFF)
printbuf()
fbuf.scroll(0, 1)
printbuf()
@@ -48,11 +50,11 @@ buf2 = bytearray(w2 * h2 * 2)
fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565)
fbuf2.fill(0x0000)
-fbuf2.pixel(0, 0, 0x0ee0)
-fbuf2.pixel(0, 2, 0xee00)
-fbuf2.pixel(1, 0, 0x00ee)
-fbuf2.pixel(1, 2, 0xe00e)
-fbuf.fill(0xffff)
+fbuf2.pixel(0, 0, 0x0EE0)
+fbuf2.pixel(0, 2, 0xEE00)
+fbuf2.pixel(1, 0, 0x00EE)
+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)