[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs da5576a321 008/472: Add UTs. Close #6
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs da5576a321 008/472: Add UTs. Close #6 |
Date: |
Thu, 6 Jan 2022 21:59:00 -0500 (EST) |
branch: elpa/pacmacs
commit da5576a3216c115c234c2c21c93e1df9d26a7195
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Add UTs. Close #6
---
Cask | 10 ++++++++++
pacman-anim.el | 19 ------------------
pacman-resources.el | 9 ---------
pacman.el | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 65 insertions(+), 30 deletions(-)
diff --git a/Cask b/Cask
new file mode 100644
index 0000000000..d6f80229e4
--- /dev/null
+++ b/Cask
@@ -0,0 +1,10 @@
+(source gnu)
+(source melpa)
+
+(package-file "pacman.el")
+
+(files ".el")
+
+(development
+ (depends-on "el-mock")
+ (depends-on "ert-runner"))
diff --git a/pacman-anim.el b/pacman-anim.el
deleted file mode 100644
index ca73ef3901..0000000000
--- a/pacman-anim.el
+++ /dev/null
@@ -1,19 +0,0 @@
-
-(defun pacman-anim-get-frame (anim)
- (let ((frames (plist-get anim :frames))
- (current-frame (plist-get anim :current-frame)))
- (nth current-frame frames)))
-
-(defun pacman-anim-next-frame (anim)
- (let* ((frames (plist-get anim :frames))
- (current-frame (plist-get anim :current-frame))
- (new-current-frame (mod (+ current-frame 1)
- (length frames))))
- (plist-put anim :current-frame new-current-frame)))
-
-(defun pacman-anim-object-next-frame (anim-object)
- (let ((anim (plist-get anim-object :animation)))
- (plist-put anim-object :animation
- (pacman-anim-next-frame anim))))
-
-(provide 'pacman-anim)
diff --git a/pacman-resources.el b/pacman-resources.el
deleted file mode 100644
index fa8ab4e0f1..0000000000
--- a/pacman-resources.el
+++ /dev/null
@@ -1,9 +0,0 @@
-
-(defun pacman-load-resource (filename)
- (create-image (concat default-directory filename)
- 'png nil :heuristic-mask t))
-
-(defun pacman-insert-image (resource resource-vector)
- (insert-image resource " " nil resource-vector))
-
-(provide 'pacman-resources)
diff --git a/pacman.el b/pacman.el
index 3dd08c2ae9..39df9f3128 100644
--- a/pacman.el
+++ b/pacman.el
@@ -1,5 +1,31 @@
-(require 'pacman-resources)
-(require 'pacman-anim)
+;;; pacman.el --- Pacman for Emacs
+
+;; Copyright (C) 2014 Codingteam
+
+;; Author: Codingteam <codingteam@conference.jabber.ru>
+;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
+;; URL: http://github.com/rexim/pacman.el
+;; Version: 0.0.1
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
(defconst pacman-buffer-name "*Pacman*")
@@ -18,6 +44,10 @@
'(40 0 20 20))
:current-frame 0)))
+(defun pacman-load-resource (filename)
+ (create-image (concat default-directory filename)
+ 'png nil :heuristic-mask t))
+
(defvar pacman-resource (pacman-load-resource "pacman10-hp-sprite.png"))
(define-derived-mode pacman-mode special-mode "pacman-mode"
@@ -28,6 +58,27 @@
(define-key pacman-mode-map (kbd "q") 'pacman-quit)
(add-hook 'kill-buffer-hook 'pacman-destroy nil t))
+(defun pacman-insert-image (resource resource-vector)
+ (insert-image resource " " nil resource-vector))
+
+;;;###autoload
+(defun pacman-anim-get-frame (anim)
+ (let ((frames (plist-get anim :frames))
+ (current-frame (plist-get anim :current-frame)))
+ (nth current-frame frames)))
+
+(defun pacman-anim-next-frame (anim)
+ (let* ((frames (plist-get anim :frames))
+ (current-frame (plist-get anim :current-frame))
+ (new-current-frame (mod (+ current-frame 1)
+ (length frames))))
+ (plist-put anim :current-frame new-current-frame)))
+
+(defun pacman-anim-object-next-frame (anim-object)
+ (let ((anim (plist-get anim-object :animation)))
+ (plist-put anim-object :animation
+ (pacman-anim-next-frame anim))))
+
(defun pacman-start ()
(interactive)
(switch-to-buffer-other-window pacman-buffer-name)
@@ -82,3 +133,5 @@
)
(provide 'pacman)
+
+;;; pacman.el ends here
- [nongnu] elpa/pacmacs 58cf91b060 032/472: Enable undercover (#27), (continued)
- [nongnu] elpa/pacmacs 58cf91b060 032/472: Enable undercover (#27), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 30b5c43879 040/472: License header (#28):, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 59b5b95c2d 039/472: Share the sprites source files. Close #25, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5780c37396 044/472: Add UT for pacman-make-anim function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1f32ee2489 048/472: Implement board state (#5), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1b26ae45fc 055/472: Convert sprites to XPM. Close #49, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 03a96041d9 056/472: Add a README note about limitations. Close #45, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 13593c3f25 003/472: Remove logging, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e788307d07 007/472: Implement animation. Close #10, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7a713ac0b7 010/472: Add UTs again, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs da5576a321 008/472: Add UTs. Close #6,
ELPA Syncer <=
- [nongnu] elpa/pacmacs 515b977a4c 026/472: Add UT for pacman-anim-next-frame function (#22), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 03bdb3388f 012/472: Add README. Close #18, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8283a893c2 018/472: Update README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0828edabf2 019/472: Don't remove elc files during Travis build (#20), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 63bfb71c85 029/472: Add UT for pacman-aseprite-frame-get-order (#22), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3554251103 033/472: Add coveralls badge (#27), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 56968d5966 034/472: Require undercover in test-helpers (#27), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 833e2d8de2 041/472: Add a note about the licensing to README (#28), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs cb29133875 045/472: Add UT for pacman-load-anim function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 14e4a5a771 046/472: Mystical cookies appear! Close #15, ELPA Syncer, 2022/01/06