diff options
| author | F. Jason Park | 2023-05-04 00:01:11 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-07-13 18:45:31 -0700 |
| commit | ded35c2da4da52641ec99927347cd50b736b9577 (patch) | |
| tree | b8f865ed50f352031da634170d3244d41e427bf6 /test | |
| parent | 3c70e85d362262d096301e7663a11ca8c392f526 (diff) | |
| download | emacs-ded35c2da4da52641ec99927347cd50b736b9577.tar.gz emacs-ded35c2da4da52641ec99927347cd50b736b9577.zip | |
Add erc-status-sidebar integration to erc-speedbar
* lisp/erc/erc-speedbar.el: Require `erc-button' atop file and don't
bother loading `dframe', which `speedbar' handles for us.
(erc-speedbar): Explain that `nickbar' is the module for this group
and library for the benefit of those who run M-x customize-group.
(erc-speedbar-nicknames-window-width): New option.
(erc-speedbar-hide-mode-topic): New option determining whether to hide
the mode and topic.
(erc-speedbar-my-nick-face): New option for determining face to use
when displaying user's current nick.
(erc-speedbar-browser): Call `erc-install-speedbar-variables'
explicitly and remove top-level `with-eval-after-load'.
(erc-speedbar-insert-target): Add parenthesized channel count after
channel name in server and channel views.
(erc-speedbar-expand-channel): Hide mode and topic depending on option
`erc-speedbar-hide-mode-topic' and pass buffer to
`erc-speedbar-insert-user'.
(erc-speedbar--nick-face-function): New internal function-valued
variable.
(erc-speedbar--highlight-self-and-ops): New function to serve as
default value for `erc-speedbar--nick-face-function'.
(erc-speedbar--on-click): Dispatch `erc-nick-popup' after trimming
status chars.
(erc-speedbar-insert-user): Revise doc string. Call
`erc-speedbar--nick-face-function' to determine face. Change
token for both expansion and on-click text props. Assign
`erc-speedbar--on-click' as the mouse handler for nick items.
(erc-speedbar--buffer-options): Variable to override options locally
in speedbar buffer.
(erc-speedbar--hidden-speedbar-frame): Add variable to hold original
`speedbar-frame' before spoofing by setting to selected frame
containing window showing ERC buffer.
(erc-speedbar--emulate-sidebar-set-window-preserve-size,
erc-speedbar--status-sidebar-mode--unhook): Add function
to ensure status sidebar is showing correctly and helper to
unregister from hook on teardown.
(erc-speedbar--emulate-sidebar): Add function to control sidebar
nicknames setup.
(erc-speedbar--toggle-nicknames-sidebar): Add toggle function
for speedbar or emulated sidebar.
(erc-speedbar--ensure): Add helper function to show speedbar if it's
hidden or create one if none exists.
(erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable):
Add new mini module.
(erc-speedbar--dframe-controlled) Add function to overwrite
`speedbar-frame-mode' as `dframe-controlled' in speedbar buffer.
(erc-speedbar-toggle-nicknames-window-lock,
erc-speedbar-close-nicknames-window): Add commands to close speedbar
window and toggle its cyclability.
(erc-speedbar--compose-nicks-face): Add helper for nicks integration.
* test/lisp/erc/erc-scenarios-status-sidebar.el
(erc-scenarios-status-sidebar--nickbar): New test. (Bug#63595)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-scenarios-status-sidebar.el | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-scenarios-status-sidebar.el b/test/lisp/erc/erc-scenarios-status-sidebar.el index 5144069ec0e..92229121c9f 100644 --- a/test/lisp/erc/erc-scenarios-status-sidebar.el +++ b/test/lisp/erc/erc-scenarios-status-sidebar.el | |||
| @@ -90,4 +90,80 @@ | |||
| 90 | (erc-status-sidebar-kill) | 90 | (erc-status-sidebar-kill) |
| 91 | (should-not (get-buffer "*ERC Status*")))))) | 91 | (should-not (get-buffer "*ERC Status*")))))) |
| 92 | 92 | ||
| 93 | ;; We can't currently run this on EMBA because it needs a usable | ||
| 94 | ;; terminal, and we lack a fixture for that. Please try running this | ||
| 95 | ;; test interactively with both graphical Emacs and non. | ||
| 96 | (declare-function erc-nickbar-mode "erc-speedbar" (arg)) | ||
| 97 | (declare-function erc-speedbar-close-nicknames-window "erc-speedbar" (kill)) | ||
| 98 | (declare-function speedbar-timer-fn "speedbar" nil) | ||
| 99 | (defvar erc-nickbar-mode) | ||
| 100 | (defvar speedbar-buffer) | ||
| 101 | |||
| 102 | (ert-deftest erc-scenarios-status-sidebar--nickbar () | ||
| 103 | :tags '(:unstable :expensive-test) | ||
| 104 | (when noninteractive (ert-skip "Interactive only")) | ||
| 105 | |||
| 106 | (erc-scenarios-common-with-cleanup | ||
| 107 | ((erc-scenarios-common-dialog "base/gapless-connect") | ||
| 108 | (erc-server-flood-penalty 0.1) | ||
| 109 | (erc-server-flood-penalty erc-server-flood-penalty) | ||
| 110 | (erc-modules `(nickbar ,@erc-modules)) | ||
| 111 | (dumb-server (erc-d-run "localhost" t 'foonet 'barnet)) | ||
| 112 | (port (process-contact dumb-server :service)) | ||
| 113 | (expect (erc-d-t-make-expecter))) | ||
| 114 | |||
| 115 | (ert-info ("Connect to two different endpoints") | ||
| 116 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 117 | :port port | ||
| 118 | :nick "tester" | ||
| 119 | :password "foonet:changeme" | ||
| 120 | :full-name "tester") | ||
| 121 | (funcall expect 10 "MOTD File is missing")) | ||
| 122 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 123 | :port port | ||
| 124 | :nick "tester" | ||
| 125 | :password "barnet:changeme" | ||
| 126 | :full-name "tester") | ||
| 127 | (funcall expect 10 "marked as being away"))) | ||
| 128 | |||
| 129 | (erc-d-t-wait-for 20 (get-buffer "#bar")) | ||
| 130 | (with-current-buffer (pop-to-buffer "#bar") | ||
| 131 | (funcall expect 10 "was created on") | ||
| 132 | (funcall expect 2 "his second fit") | ||
| 133 | (erc-d-t-wait-for 10 (and speedbar-buffer (get-buffer speedbar-buffer))) | ||
| 134 | (speedbar-timer-fn) | ||
| 135 | (with-current-buffer speedbar-buffer | ||
| 136 | (funcall expect 10 "#bar (3)") | ||
| 137 | (funcall expect 10 '(| "@mike" "joe")) | ||
| 138 | (funcall expect 10 '(| "@mike" "joe")) | ||
| 139 | (funcall expect 10 "tester"))) | ||
| 140 | |||
| 141 | (erc-d-t-wait-for 20 (get-buffer "#foo")) | ||
| 142 | (with-current-buffer (pop-to-buffer "#foo") | ||
| 143 | (delete-other-windows) | ||
| 144 | (funcall expect 10 "was created on") | ||
| 145 | (funcall expect 2 "no use of him") | ||
| 146 | (speedbar-timer-fn) | ||
| 147 | (with-current-buffer speedbar-buffer | ||
| 148 | (funcall expect 10 "#foo (3)") | ||
| 149 | (funcall expect 10 '(| "alice" "@bob")) | ||
| 150 | (funcall expect 10 '(| "alice" "@bob")) | ||
| 151 | (funcall expect 10 "tester"))) | ||
| 152 | |||
| 153 | (with-current-buffer "#foo" | ||
| 154 | (ert-info ("Core toggle and kill commands work") | ||
| 155 | ;; Avoid using API, e.g., `erc-status-sidebar-buffer-exists-p', | ||
| 156 | ;; etc. for testing commands that call those same functions. | ||
| 157 | (erc-nickbar-mode -1) | ||
| 158 | (should-not (and speedbar-buffer | ||
| 159 | (get-buffer-window speedbar-buffer))) | ||
| 160 | (erc-nickbar-mode +1) | ||
| 161 | (should (and speedbar-buffer | ||
| 162 | (get-buffer-window speedbar-buffer))) | ||
| 163 | (should (get-buffer " SPEEDBAR")) | ||
| 164 | (erc-speedbar-close-nicknames-window 'kill) | ||
| 165 | (should-not (get-buffer " SPEEDBAR")) | ||
| 166 | (should-not erc-nickbar-mode) | ||
| 167 | (should-not (cdr (frame-list))))))) | ||
| 168 | |||
| 93 | ;;; erc-scenarios-status-sidebar.el ends here | 169 | ;;; erc-scenarios-status-sidebar.el ends here |