[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/topspace 7d384d0568 120/181: Add mouse-scrolling test
From: |
ELPA Syncer |
Subject: |
[elpa] externals/topspace 7d384d0568 120/181: Add mouse-scrolling test |
Date: |
Tue, 23 Aug 2022 12:58:40 -0400 (EDT) |
branch: externals/topspace
commit 7d384d056804f0df183a046d85e5ec2284436a61
Author: Trevor Pogue <poguete@mcmaster.ca>
Commit: Trevor Pogue <poguete@mcmaster.ca>
Add mouse-scrolling test
---
.gitignore | 3 ++-
tests/director-bootstrap.el | 4 +---
tests/director.el | 7 ++++++-
tests/run | 28 ++++++++++++++++++++++------
tests/tests.el | 43 +++++++++++++++++++++++++++++++------------
5 files changed, 62 insertions(+), 23 deletions(-)
diff --git a/.gitignore b/.gitignore
index 54450dd53a..dea17d56b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-*.~undo-tree~
\ No newline at end of file
+*.~undo-tree~
+.projectile
\ No newline at end of file
diff --git a/tests/director-bootstrap.el b/tests/director-bootstrap.el
index 32b9c0fd5e..546663c093 100644
--- a/tests/director-bootstrap.el
+++ b/tests/director-bootstrap.el
@@ -12,7 +12,7 @@
"Setup the environment for a simulated user session."
(require 'package)
-
+
(setq byte-compile-warnings nil)
(when (boundp 'comp-async-report-warnings-errors)
(setq comp-async-report-warnings-errors nil))
@@ -30,7 +30,6 @@
;; attempt requiring director here; if error, add director to list of
required
;; packages, and retry after initializing packages
-
(package-initialize)
(when packages
(add-to-list 'package-archives '("melpa" .
"https://melpa.org/packages/") t)
@@ -39,4 +38,3 @@
(package-install package))))
(require 'director)))
-
diff --git a/tests/director.el b/tests/director.el
index aeb1fe0d5c..a7bc633efc 100644
--- a/tests/director.el
+++ b/tests/director.el
@@ -80,6 +80,7 @@ A step can be one of:
using `listify-key-sequence' and can contain special
characters, e.g. `(:type \"\\M-xsetenv\\r\")'
- `:call': shortcut to invoke an interactive command, e.g. `(:call setenv)'
+- `:run': Lisp form; it will be evaluated
- `:log': Lisp form; it will be evaluated and its result will be
written to log; e.g. `(:log (buffer-file-name (current-buffer)))'
- `:wait': number; seconds to wait before next step; overrides
@@ -198,6 +199,10 @@ If DELAY-OVERRIDE is non-nil, the next step is delayed by
that value rather than
(director--schedule-next)
(call-interactively command))
+ (`(:run ,form)
+ (eval form)
+ (director--schedule-next))
+
(`(:log ,form)
(director--schedule-next)
(director--log (format "LOG %S" (eval form))))
@@ -216,7 +221,7 @@ If DELAY-OVERRIDE is non-nil, the next step is delayed by
that value rather than
(`(:suspend)
nil)
-
+
(`(:assert ,condition)
(or (eval condition)
(setq director--failure condition))
diff --git a/tests/run b/tests/run
index 6b68ce9c0d..11df816c40 100755
--- a/tests/run
+++ b/tests/run
@@ -1,15 +1,31 @@
#!/usr/bin/env bash
-# set -e
+check-result() {
+ if [ $? -eq 0 ]; then
+ echo PASSED $1
+ else
+ echo FAILED $1
+ [ -z "$total_fails" ] && total_fails=0
+ ((total_fails++))
+ fi
+}
+
this_scripts_dir="$(cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
cd $this_scripts_dir
+
emacs -Q \
-l ../topspace.el \
-l ./director.el \
-l ./director-bootstrap.el \
-l ./tests.el
-if [ $? -eq 0 ]; then
- echo PASS
-else
- echo FAIL
-fi
+check-result 'in GUI emacs'
+
+emacs -Q -nw \
+ -l ../topspace.el \
+ -l ./director.el \
+ -l ./director-bootstrap.el \
+ -l ./tests.el
+check-result 'in terminal emacs'
+
+[ -n "$total_fails" ] && echo FAILED $total_fails tests && exit 1
+echo PASSED all tests
diff --git a/tests/tests.el b/tests/tests.el
index 65e74e84ae..52267c61b5 100644
--- a/tests/tests.el
+++ b/tests/tests.el
@@ -1,14 +1,11 @@
;; Run with:
;;
;; emacs -Q -nw -l ../../util/director-bootstrap.el -l demo.el
-;; (require 'topspace)
(director-bootstrap
:user-dir "/tmp/director-demo"
:packages '()
- :load-path '("./"))
-
-(defun t-t () (kill-emacs 1))
+ :load-path '("../.."))
(director-run
:version 1
@@ -20,21 +17,43 @@
(global-topspace-mode)
)
:steps '(
- (:type "\M-v")
- (:type "\C-\M-n")
+ ;; Test scrolling using key commands
+ (:type "\M-v") ;; page down
+ (:type "\C-\M-n") ;; scroll down line
+ (:assert (setq topspace--tests-prev-height (topspace--height)))
+ (:type "\C-n") ;; next-line
+ (:assert (= (topspace--height) (1- topspace--tests-prev-height)))
+ (:type "\C-u2\C-n");; next-line x2
+ (:assert (= (topspace--height) (- topspace--tests-prev-height 3)))
+ (:type "\C-\M-n") ;; scroll down line
+ (:assert (= (topspace--height) (- topspace--tests-prev-height 2)))
+ (:type "\C-u2\C-\M-n") ;; scroll down line x2
+ (:assert (= (topspace--height) topspace--tests-prev-height))
+ ;; reset top line to top of window:
+ (:type "\C-v") ;; page up
+ (:assert (= (topspace--height) 1))
+ (:type "\C-\M-p") ;; scroll up line
+ (:assert (= (topspace--height) 0))
+ (:assert (= (window-start) 1))
+
+ ;; Test mouse scrolling
+ (:type "\M-v") ;; page down
+ (:run (mwheel-scroll mouse-wheel-down-event)) ;; scroll down line
(:assert (setq topspace--tests-prev-height (topspace--height)))
- (:type "\C-n")
+ (:type "\C-n") ;; next-line
(:assert (= (topspace--height) (1- topspace--tests-prev-height)))
- (:type "\C-u2\C-n")
+ (:type "\C-u2\C-n");; next-line x2
(:assert (= (topspace--height) (- topspace--tests-prev-height 3)))
- (:type "\C-\M-n")
+ (:run (mwheel-scroll mouse-wheel-down-event)) ;; scroll down line
+ (:run (mwheel-scroll mouse-wheel-up-event)) ;; scroll up line
+ (:run (mwheel-scroll mouse-wheel-down-event)) ;; scroll down line
(:assert (= (topspace--height) (- topspace--tests-prev-height 2)))
- (:type "\C-u2\C-\M-n")
+ (:run (mwheel-scroll mouse-wheel-down-event)) ;; scroll down line
+ (:run (mwheel-scroll mouse-wheel-down-event)) ;; scroll down line
(:assert (= (topspace--height) topspace--tests-prev-height))
)
:typing-style 'human
:delay-between-steps 0.1
:after-end (lambda () (kill-emacs 0))
:on-failure (lambda () (kill-emacs 1))
- :on-error (lambda () (kill-emacs 1))
- )
+ :on-error (lambda () (kill-emacs 1)))
- [elpa] externals/topspace 483ef53957 090/181: Add topspace-empty-line-indicator defcustom (#8), (continued)
- [elpa] externals/topspace 483ef53957 090/181: Add topspace-empty-line-indicator defcustom (#8), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 4e8a2cad75 080/181: Fix automatic changelog generation action, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a6c375a96f 092/181: Fix typo caused in merge, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 1daae45343 095/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace bdf5d43aaa 097/181: Support different line-heights (#10), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace b372216aed 102/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace d585e1cfaa 105/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a873b9f61d 106/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace f72d5cbaa1 111/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace bf13e37483 118/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 7d384d0568 120/181: Add mouse-scrolling test,
ELPA Syncer <=
- [elpa] externals/topspace 74ba25eee4 117/181: Update HISTORY.md format to match CHANGELOG.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 97334a2089 122/181: Bump version: 0.2.0 → 0.2.1, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace c78ac7edd9 137/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 8c2b1e4391 146/181: Increase test coverage, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace cbd1f7e8da 154/181: Remove cl-lib dependency in Cask, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 6ed32d2426 162/181: Update NEWS.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 97c2216b72 167/181: Update .elpaignore, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 28f3792bf3 159/181: Internal refactoring, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 8d44371ff0 002/181: Create LICENSE, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 3e24bc6657 003/181: Initial code commit, ELPA Syncer, 2022/08/23