diff --git a/TODO.md b/TODO.md index fd3ec05..b139413 100644 --- a/TODO.md +++ b/TODO.md @@ -19,7 +19,7 @@ - [x] Peeking at config - [x] inspect characters at (x, y) - [x] inspect color at (x, y) -- [ ] raw color +- [x] raw color - [x] **DOCS** - [x] What argument type should `draw_pixels` accept for the pixel array? <- This is pretty much done 1. array (pretty fast) @@ -72,6 +72,6 @@ - [x] Docs for the loader -- [ ] Write a tutorial +- [x] Write a tutorial - [x] Add some examples - [x] Installation diff --git a/pyproject.toml b/pyproject.toml index ecc1710..b2991c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "chafa.py" -version = "1.0.2" +version = "1.1.0" license = "LGPL-3.0" authors = [ @@ -95,7 +95,7 @@ test-command = "MAGICK_HOME=/opt/homebrew/Cellar/imagemagick pytest -rP {package [tool.cibuildwheel.windows] -test-command = "pytest -rP {package}/tests/0_PIL_test.py" +test-command = "pytest -rP {package}/tests/0_PIL_test.py {package}/tests/2_raw_test.py {package}/tests/3_capabilities_test.py" [tool.hatch.build] exclude = [ diff --git a/tests/2_raw_test.py b/tests/2_raw_test.py index 38e69fd..0c57730 100644 --- a/tests/2_raw_test.py +++ b/tests/2_raw_test.py @@ -1,43 +1,44 @@ from chafa import * -config = CanvasConfig() +def test_raw(): + config = CanvasConfig() -config.width = 36 -config.height = (256 - (16+24)) // 36 + 2 + config.width = 36 + config.height = (256 - (16+24)) // 36 + 2 -config.canvas_mode = CanvasMode.CHAFA_CANVAS_MODE_INDEXED_256 + config.canvas_mode = CanvasMode.CHAFA_CANVAS_MODE_INDEXED_256 -pixels = [0, 0, 0, 0] + pixels = [0, 0, 0, 0] -canvas = Canvas(config) -canvas.draw_all_pixels( - PixelType.CHAFA_PIXEL_RGBA8_PREMULTIPLIED, - pixels, - 1, 1, 3 -) + canvas = Canvas(config) + canvas.draw_all_pixels( + PixelType.CHAFA_PIXEL_RGBA8_PREMULTIPLIED, + pixels, + 1, 1, 3 + ) -for row in canvas[:]: - for pix in row: - pix.char = "▀" - pix.remove_foreground() + for row in canvas[:]: + for pix in row: + pix.char = "▀" + pix.remove_foreground() -for pix in canvas[0,:16]: - pix.raw_fg_color = pix.x + for pix in canvas[0,:16]: + pix.raw_fg_color = pix.x -for row in canvas[1:-1, :]: - for pix in row: - pix.raw_fg_color = pix.x + 16 + ((pix.y-1) * 5 * config.width//5) + for row in canvas[1:-1, :]: + for pix in row: + pix.raw_fg_color = pix.x + 16 + ((pix.y-1) * 5 * config.width//5) -for pix in canvas[-1, :24]: - pix.raw_fg_color = 255 - (23 - pix.x) + for pix in canvas[-1, :24]: + pix.raw_fg_color = 255 - (23 - pix.x) -i = 0 -for pix in canvas[-1, -5:-1]: - pix.char = str(i) - i+=1 - pix.raw_fg_color = 3 + i = 0 + for pix in canvas[-1, -5:-1]: + pix.char = str(i) + i+=1 + pix.raw_fg_color = 3 -print(canvas.print().decode()) + print(canvas.print().decode())