summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/framebuf4.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/framebuf4.py
parent488613bca6c460340ed2995ae5cafafe22d0bfff (diff)
downloadmicropython-3dc324d3f1312e40d3a8ed87e7244966bb756f26.tar.gz
micropython-3dc324d3f1312e40d3a8ed87e7244966bb756f26.zip
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/framebuf4.py')
-rw-r--r--tests/extmod/framebuf4.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/tests/extmod/framebuf4.py b/tests/extmod/framebuf4.py
index 8358fa55b9..56593ee155 100644
--- a/tests/extmod/framebuf4.py
+++ b/tests/extmod/framebuf4.py
@@ -4,50 +4,52 @@ 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 = 16
h = 8
buf = bytearray(w * h // 2)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB)
# fill
-fbuf.fill(0x0f)
+fbuf.fill(0x0F)
printbuf()
-fbuf.fill(0xa0)
+fbuf.fill(0xA0)
printbuf()
# put pixel
fbuf.pixel(0, 0, 0x01)
printbuf()
-fbuf.pixel(w-1, 0, 0x02)
+fbuf.pixel(w - 1, 0, 0x02)
printbuf()
-fbuf.pixel(w-1, h-1, 0x03)
+fbuf.pixel(w - 1, h - 1, 0x03)
printbuf()
-fbuf.pixel(0, h-1, 0x04)
+fbuf.pixel(0, h - 1, 0x04)
printbuf()
# get pixel
-print(fbuf.pixel(0, 0), fbuf.pixel(w-1, 0), fbuf.pixel(w-1, h-1), fbuf.pixel(0, h-1))
-print(fbuf.pixel(1, 0), fbuf.pixel(w-2, 0), fbuf.pixel(w-2, h-1), fbuf.pixel(1, h-1))
+print(fbuf.pixel(0, 0), fbuf.pixel(w - 1, 0), fbuf.pixel(w - 1, h - 1), fbuf.pixel(0, h - 1))
+print(fbuf.pixel(1, 0), fbuf.pixel(w - 2, 0), fbuf.pixel(w - 2, h - 1), fbuf.pixel(1, h - 1))
# fill rect
-fbuf.fill_rect(0, 0, w, h, 0x0f)
+fbuf.fill_rect(0, 0, w, h, 0x0F)
printbuf()
-fbuf.fill_rect(0, 0, w, h, 0xf0)
-fbuf.fill_rect(1, 0, w//2+1, 1, 0xf1)
+fbuf.fill_rect(0, 0, w, h, 0xF0)
+fbuf.fill_rect(1, 0, w // 2 + 1, 1, 0xF1)
printbuf()
-fbuf.fill_rect(1, 0, w//2+1, 1, 0x10)
-fbuf.fill_rect(1, 0, w//2, 1, 0xf1)
+fbuf.fill_rect(1, 0, w // 2 + 1, 1, 0x10)
+fbuf.fill_rect(1, 0, w // 2, 1, 0xF1)
printbuf()
-fbuf.fill_rect(1, 0, w//2, 1, 0x10)
-fbuf.fill_rect(0, h-4, w//2+1, 4, 0xaf)
+fbuf.fill_rect(1, 0, w // 2, 1, 0x10)
+fbuf.fill_rect(0, h - 4, w // 2 + 1, 4, 0xAF)
printbuf()
-fbuf.fill_rect(0, h-4, w//2+1, 4, 0xb0)
-fbuf.fill_rect(0, h-4, w//2, 4, 0xaf)
+fbuf.fill_rect(0, h - 4, w // 2 + 1, 4, 0xB0)
+fbuf.fill_rect(0, h - 4, w // 2, 4, 0xAF)
printbuf()
-fbuf.fill_rect(0, h-4, w//2, 4, 0xb0)
+fbuf.fill_rect(0, h - 4, w // 2, 4, 0xB0)