aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Jason Park2024-03-19 23:51:46 -0700
committerF. Jason Park2024-03-23 15:10:32 -0700
commit44be4fa8e652f08cad0cd6a85abcd54c691a7c27 (patch)
treeef0e7a67e3511aebd91a405f8362633c0b7d8cab
parent0f04aa06a69cb82eb66d5ffd46700ffdbd58b8f3 (diff)
downloademacs-44be4fa8e652f08cad0cd6a85abcd54c691a7c27.tar.gz
emacs-44be4fa8e652f08cad0cd6a85abcd54c691a7c27.zip
Remove unused faces from various erc-goodies tests
; A note to anyone running ERC's test suite while bisecting and ; unlucky enough to land on this commit: apologies for the ; inconvenience. It fails because it includes adjustments for fixes ; only introduced by the subsequent commit. This is obviously ; objectionable but was done knowingly in order to duck the ; copyright-exemption threshold for new contributors. * test/lisp/erc/erc-goodies-tests.el (erc-controls-highlight--spoilers) (erc-controls-highlight--inverse): Remove all mention of stricken faces `erc-control-default-fg' and `erc-control-default-bg'. (erc-controls-highlight/default-foreground) (erc-controls-highlight/default-background): New tests. (Bug#69860)
-rw-r--r--test/lisp/erc/erc-goodies-tests.el127
1 files changed, 116 insertions, 11 deletions
diff --git a/test/lisp/erc/erc-goodies-tests.el b/test/lisp/erc/erc-goodies-tests.el
index c8fb0544a72..7cbaa39d3f7 100644
--- a/test/lisp/erc/erc-goodies-tests.el
+++ b/test/lisp/erc/erc-goodies-tests.el
@@ -167,15 +167,13 @@
167 '(fg:erc-color-face1 bg:erc-color-face1)) 167 '(fg:erc-color-face1 bg:erc-color-face1))
168 ;; Masked in all black. 168 ;; Masked in all black.
169 (erc-goodies-tests--assert-face 169 (erc-goodies-tests--assert-face
170 20 "BlackOnBlack" '(fg:erc-color-face1 bg:erc-color-face1) 170 20 "BlackOnBlack" '(fg:erc-color-face1 bg:erc-color-face1) nil)
171 '(erc-control-default-fg erc-control-default-bg))
172 ;; Explicit "default" code ignoerd. 171 ;; Explicit "default" code ignoerd.
173 (erc-goodies-tests--assert-face 172 (erc-goodies-tests--assert-face
174 34 "Default" '(erc-control-default-fg erc-control-default-bg) 173 34 "Default" '(erc-default-face)
175 '(fg:erc-color-face1 bg:erc-color-face1)) 174 '(fg:erc-color-face1 bg:erc-color-face1))
176 (erc-goodies-tests--assert-face 175 (erc-goodies-tests--assert-face
177 43 "END" 'erc-default-face 176 43 "END" 'erc-default-face nil)))
178 '(erc-control-default-bg erc-control-default-fg))))
179 (when noninteractive 177 (when noninteractive
180 (erc-tests-common-kill-buffers))) 178 (erc-tests-common-kill-buffers)))
181 179
@@ -214,17 +212,124 @@
214 nil) 212 nil)
215 ;; The inverse of `default' because reverse still in effect. 213 ;; The inverse of `default' because reverse still in effect.
216 (erc-goodies-tests--assert-face 214 (erc-goodies-tests--assert-face
217 32 "ReversedDefault" '(erc-inverse-face erc-control-default-fg 215 32 "ReversedDefault" '(erc-inverse-face erc-default-face)
218 erc-control-default-bg)
219 '(fg:erc-color-face3 bg:erc-color-face13)) 216 '(fg:erc-color-face3 bg:erc-color-face13))
220 (erc-goodies-tests--assert-face 217 (erc-goodies-tests--assert-face
221 49 "NormalDefault" '(erc-control-default-fg 218 49 "NormalDefault" '(erc-default-face)
222 erc-control-default-bg)
223 '(erc-inverse-face fg:erc-color-face1 bg:erc-color-face1)) 219 '(erc-inverse-face fg:erc-color-face1 bg:erc-color-face1))
224 (erc-goodies-tests--assert-face 220 (erc-goodies-tests--assert-face
225 64 "END" 'erc-default-face 221 64 "END" 'erc-default-face
226 '( erc-control-default-fg erc-control-default-bg 222 '(fg:erc-color-face0 bg:erc-color-face0))))
227 fg:erc-color-face0 bg:erc-color-face0)))) 223 (when noninteractive
224 (erc-tests-common-kill-buffers)))
225
226;; This is meant to assert two behavioral properties:
227;;
228;; 1) The background is preserved when only a new foreground is
229;; defined, in accordance with this bit from the spec: "If only the
230;; foreground color is set, the background color stays the same."
231;; https://modern.ircdocs.horse/formatting#color
232;;
233;; 2) The same holds true for a new, lone foreground of 99. Rather
234;; than prepend `erc-default-face', this causes the removal of an
235;; existing foreground face and likewise doesn't clobber the
236;; existing background.
237(ert-deftest erc-controls-highlight/default-foreground ()
238 (should (eq t erc-interpret-controls-p))
239 (erc-tests-common-make-server-buf)
240 (with-current-buffer (erc--open-target "#chan")
241 (setq-local erc-interpret-mirc-color t)
242 (defvar erc-fill-column)
243 (let ((erc-fill-column 90))
244 (erc-display-message nil nil (current-buffer)
245 (erc-format-privmessage
246 "bob" (concat "BEGIN "
247 "\C-c03,08 GreenOnYellow "
248 "\C-c99 BlackOnYellow "
249 "\C-o END")
250 nil t)))
251 (forward-line -1)
252 (should (search-forward "<bob> " nil t))
253 (should (erc-tests-common-equal-with-props
254 (erc--remove-text-properties
255 (buffer-substring (point) (line-end-position)))
256 #("BEGIN GreenOnYellow BlackOnYellow END"
257 0 6 (font-lock-face erc-default-face)
258 6 21 (font-lock-face (fg:erc-color-face3
259 bg:erc-color-face8
260 erc-default-face))
261 21 36 (font-lock-face (bg:erc-color-face8
262 erc-default-face))
263 36 40 (font-lock-face (erc-default-face)))))
264 (should (search-forward "BlackOnYellow"))
265 (let ((faces (get-text-property (point) 'font-lock-face)))
266 (should (equal (face-background (car faces) nil (cdr faces))
267 "yellow")))
268
269 ;; Redefine background color alongside default foreground.
270 (let ((erc-fill-column 90))
271 (erc-display-message nil nil (current-buffer)
272 (erc-format-privmessage
273 "bob" (concat "BEGIN "
274 "\C-c03,08 GreenOnYellow "
275 "\C-c99,07 BlackOnOrange "
276 "\C-o END")
277 nil t)))
278 (should (search-forward "<bob> " nil t))
279 (should (erc-tests-common-equal-with-props
280 (erc--remove-text-properties
281 (buffer-substring (point) (line-end-position)))
282 #("BEGIN GreenOnYellow BlackOnOrange END"
283 0 6 (font-lock-face erc-default-face)
284 6 21 (font-lock-face (fg:erc-color-face3
285 bg:erc-color-face8
286 erc-default-face))
287 21 36 (font-lock-face (bg:erc-color-face7
288 erc-default-face))
289 36 40 (font-lock-face (erc-default-face)))))
290 (should (search-forward "BlackOnOrange"))
291 (let ((faces (get-text-property (point) 'font-lock-face)))
292 (should (equal (face-background (car faces) nil (cdr faces))
293 "orange")))) ; as opposed to white or black
294 (when noninteractive
295 (erc-tests-common-kill-buffers)))
296
297;; This merely asserts our current interpretation of "default faces":
298;; that they reflect the foreground and background exhibited by normal
299;; chat messages before any control-code formatting is applied (rather
300;; than, e.g., some sort of negation or no-op).
301(ert-deftest erc-controls-highlight/default-background ()
302 (should (eq t erc-interpret-controls-p))
303 (erc-tests-common-make-server-buf)
304 (with-current-buffer (erc--open-target "#chan")
305 (setq-local erc-interpret-mirc-color t)
306 (defvar erc-fill-column)
307 (let ((erc-fill-column 90))
308 (erc-display-message nil nil (current-buffer)
309 (erc-format-privmessage
310 "bob" (concat "BEGIN "
311 "\C-c03,08 GreenOnYellow "
312 "\C-c05,99 BrownOnWhite "
313 "\C-o END")
314 nil t)))
315 (forward-line -1)
316 (should (search-forward "<bob> " nil t))
317 (should (erc-tests-common-equal-with-props
318 (erc--remove-text-properties
319 (buffer-substring (point) (line-end-position)))
320 #("BEGIN GreenOnYellow BrownOnWhite END"
321 0 6 (font-lock-face erc-default-face)
322 6 21 (font-lock-face (fg:erc-color-face3
323 bg:erc-color-face8
324 erc-default-face))
325 21 35 (font-lock-face (fg:erc-color-face5
326 erc-default-face))
327 35 39 (font-lock-face (erc-default-face)))))
328 ;; Ensure the background is white or black, rather than yellow.
329 (should (search-forward "BrownOnWhite"))
330 (let ((faces (get-text-property (point) 'font-lock-face)))
331 (should (equal (face-background (car faces) nil `(,@(cdr faces) default))
332 (face-background 'default)))))
228 (when noninteractive 333 (when noninteractive
229 (erc-tests-common-kill-buffers))) 334 (erc-tests-common-kill-buffers)))
230 335