summaryrefslogtreecommitdiff
path: root/tests/test-video-audio-recording--get-available-mics.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-26 18:37:07 -0600
committerCraig Jennings <c@cjennings.net>2026-02-26 18:37:07 -0600
commit8de47fd766fe57c7f89960ee110b209a946024cb (patch)
tree134034ce36ebd3b7c2a10d6e41d12273d07dde22 /tests/test-video-audio-recording--get-available-mics.el
parent5eb90dbbd18cf9b22d83fe31303fbb09099088ed (diff)
feat(recording): intuitive labels, show muted devices, add app names
Rework quick-setup device picker: - Labels: [in use], [ready], [available], [muted] instead of PulseAudio jargon (RUNNING/IDLE/SUSPENDED) - Muted devices now shown (previously hidden) so users can see all connected hardware and understand why a device is unsuitable - Sink step shows which apps are playing through each output: "JDS Labs Element IV [in use] (Firefox, Spotify)" - Prompt changed from "audio output to monitor" to "audio output to capture" to avoid PulseAudio monitor terminology confusion - Sort order: in use → ready → available → muted
Diffstat (limited to 'tests/test-video-audio-recording--get-available-mics.el')
-rw-r--r--tests/test-video-audio-recording--get-available-mics.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/tests/test-video-audio-recording--get-available-mics.el b/tests/test-video-audio-recording--get-available-mics.el
index de9335af..86a9d05c 100644
--- a/tests/test-video-audio-recording--get-available-mics.el
+++ b/tests/test-video-audio-recording--get-available-mics.el
@@ -4,9 +4,9 @@
;; Unit tests for cj/recording--get-available-mics.
;; Verifies that available microphones are discovered correctly:
;; - Monitor sources are excluded (they capture output, not input)
-;; - Muted sources are excluded
+;; - Muted sources are included (shown with [muted] label in UI)
;; - Friendly descriptions from PulseAudio are used
-;; - PulseAudio state is included
+;; - PulseAudio state and mute status are included
;;; Code:
@@ -41,16 +41,16 @@ Each source is (name description mute state)."
(should (= 1 (length mics)))
(should (equal "alsa_input.usb-Jabra.mono" (nth 0 (car mics)))))))
-(ert-deftest test-video-audio-recording--get-available-mics-normal-filters-muted ()
- "Test that muted sources are excluded from mic list."
+(ert-deftest test-video-audio-recording--get-available-mics-normal-includes-muted ()
+ "Test that muted sources are included in mic list."
(cl-letf (((symbol-function 'shell-command-to-string)
(lambda (_cmd)
(test-mics--make-pactl-output
'(("active-mic" "Active Mic" "no" "SUSPENDED")
("muted-mic" "Muted Mic" "yes" "SUSPENDED"))))))
(let ((mics (cj/recording--get-available-mics)))
- (should (= 1 (length mics)))
- (should (equal "active-mic" (nth 0 (car mics)))))))
+ (should (= 2 (length mics)))
+ (should (equal "yes" (nth 3 (nth 1 mics)))))))
(ert-deftest test-video-audio-recording--get-available-mics-normal-uses-descriptions ()
"Test that friendly descriptions are returned as second element."
@@ -70,8 +70,17 @@ Each source is (name description mute state)."
(let ((mics (cj/recording--get-available-mics)))
(should (equal "RUNNING" (nth 2 (car mics)))))))
+(ert-deftest test-video-audio-recording--get-available-mics-normal-includes-mute-status ()
+ "Test that mute status is returned as fourth element."
+ (cl-letf (((symbol-function 'shell-command-to-string)
+ (lambda (_cmd)
+ (test-mics--make-pactl-output
+ '(("mic-a" "Mic A" "no" "RUNNING"))))))
+ (let ((mics (cj/recording--get-available-mics)))
+ (should (equal "no" (nth 3 (car mics)))))))
+
(ert-deftest test-video-audio-recording--get-available-mics-normal-multiple-mics ()
- "Test that multiple non-muted, non-monitor mics are returned."
+ "Test that multiple mics are returned including muted ones."
(cl-letf (((symbol-function 'shell-command-to-string)
(lambda (_cmd)
(test-mics--make-pactl-output
@@ -80,7 +89,8 @@ Each source is (name description mute state)."
("alsa_output.jabra.monitor" "Monitor of Jabra" "no" "SUSPENDED")
("muted-mic" "Muted Mic" "yes" "SUSPENDED"))))))
(let ((mics (cj/recording--get-available-mics)))
- (should (= 2 (length mics))))))
+ ;; 3 non-monitor sources (including the muted one)
+ (should (= 3 (length mics))))))
;;; Boundary Cases
@@ -99,14 +109,5 @@ Each source is (name description mute state)."
("sink-b.monitor" "Monitor B" "no" "SUSPENDED"))))))
(should (null (cj/recording--get-available-mics)))))
-(ert-deftest test-video-audio-recording--get-available-mics-boundary-all-muted ()
- "Test that if all non-monitor sources are muted, returns empty list."
- (cl-letf (((symbol-function 'shell-command-to-string)
- (lambda (_cmd)
- (test-mics--make-pactl-output
- '(("muted-a" "Mic A" "yes" "SUSPENDED")
- ("muted-b" "Mic B" "yes" "SUSPENDED"))))))
- (should (null (cj/recording--get-available-mics)))))
-
(provide 'test-video-audio-recording--get-available-mics)
;;; test-video-audio-recording--get-available-mics.el ends here