[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs edf7600fca 237/472: Add functions for drawing bars
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs edf7600fca 237/472: Add functions for drawing bars (#131) |
Date: |
Thu, 6 Jan 2022 21:59:28 -0500 (EST) |
branch: elpa/pacmacs
commit edf7600fca65e19dbfb7049b0e3c17970cab83f5
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Add functions for drawing bars (#131)
---
pacmacs-image.el | 10 ++++++++++
test/pacmacs-image-test.el | 26 ++++++++++++++++++++++++++
test/test-helper.el | 6 ++++++
3 files changed, 42 insertions(+)
diff --git a/pacmacs-image.el b/pacmacs-image.el
index 869ce91e3f..287d1e39ea 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -59,6 +59,16 @@
(dotimes (j weight)
(aset (aref bits (+ i row)) (+ j column) t))))
+(defun pacmacs--put-vertical-bar (bits column height weight)
+ (dotimes (w weight)
+ (dotimes (i height)
+ (aset (aref bits i) (+ column w) t))))
+
+(defun pacmacs--put-horizontal-bar (bits row width weight)
+ (dotimes (w weight)
+ (dotimes (i width)
+ (aset (aref bits (+ row w)) i t))))
+
(defun pacmacs--create-wall-block (width
height color
bottom right top left
diff --git a/test/pacmacs-image-test.el b/test/pacmacs-image-test.el
index cd0d216387..6bf68f5a1c 100644
--- a/test/pacmacs-image-test.el
+++ b/test/pacmacs-image-test.el
@@ -64,3 +64,29 @@
(pacmacs--put-bits-dot input-bits 0 0 2)
(should (equal expected-bits
input-bits))))
+
+(ert-deftest pacmacs--put-vertical-bar-test ()
+ (let ((input-bits (pacmacs--construct-2d-bool-vector
+ '((nil nil nil)
+ (nil nil nil)
+ (nil nil nil))))
+ (expected-bits (pacmacs--construct-2d-bool-vector
+ '((t t nil)
+ (t t nil)
+ (t t nil)))))
+ (pacmacs--put-vertical-bar input-bits 0 3 2)
+ (should (equal (pacmacs--bits-to-lists expected-bits)
+ (pacmacs--bits-to-lists input-bits)))))
+
+(ert-deftest pacmacs--put-horizontal-bar-test ()
+ (let ((input-bits (pacmacs--construct-2d-bool-vector
+ '((nil nil nil)
+ (nil nil nil)
+ (nil nil nil))))
+ (expected-bits (pacmacs--construct-2d-bool-vector
+ '((t t t)
+ (t t t)
+ (nil nil nil)))))
+ (pacmacs--put-horizontal-bar input-bits 0 3 2)
+ (should (equal (pacmacs--bits-to-lists expected-bits)
+ (pacmacs--bits-to-lists input-bits)))))
diff --git a/test/test-helper.el b/test/test-helper.el
index fec7193f82..acf0aa1e57 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -15,9 +15,15 @@
(cl-incf index))
result))
+(defun pacmacs--bool-vector-to-list (xs)
+ (-map #'identity xs))
+
(defun pacmacs--construct-2d-bool-vector (data)
(apply #'vector
(-map #'pacmacs--list-to-bool-vector data)))
+(defun pacmacs--bits-to-lists (bits)
+ (-map #'pacmacs--bool-vector-to-list bits))
+
(add-to-list 'load-path ".")
(load "pacmacs.el")
- [nongnu] elpa/pacmacs bfb089d1de 213/472: Exctract init code to a function (#115), (continued)
- [nongnu] elpa/pacmacs bfb089d1de 213/472: Exctract init code to a function (#115), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 09c0a15f40 217/472: Get pacmacs--object-at-p back (#122), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs daca08b8b1 219/472: Add another it case (#122), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ed46a4b500 221/472: Add big pills sprites. Close #82, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ca32745bcb 224/472: Refactor char making duplicate code (#81), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5f7b4fcb12 235/472: Rename pacmacs--put-dot function (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ba28d344be 068/472: Remove copypaste (#54), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 49e0ff0fe8 020/472: Cask: take package info from pacman.el file, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7a8db8e06c 228/472: Merge branch 'xbm-flip-bit-hack-133'. Close #133, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs f65f288b18 239/472: Cache wall tiles (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs edf7600fca 237/472: Add functions for drawing bars (#131),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 2a9ec76c28 263/472: Automate Big Pills sprites generating (#26), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a1bf99c5f7 176/472: Add an animation, close #118., ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 29b87c4538 181/472: Refactor out unpaused play state predicate, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 93f964e11e 186/472: Merge branch 'compile-on-ci-123'. Close #123, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3f7bf5c282 192/472: Fix board UTs, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 805d91d22b 194/472: Rename all the buffer stuff to board back (#105), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1ab8264214 198/472: Remove dead vars for board size (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 144a973d83 203/472: Merge branch 'slow-object-look-up-126'. Close #126, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 6a4bf8c87f 214/472: Merge branch 'integration-test-recorder-115'. Close #115, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b73dd8215c 220/472: Merge branch 'integration-test-replayer-122'. Close #122, ELPA Syncer, 2022/01/06