aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2025-03-13 20:51:12 -0300
committerDavid Bremner <david@tethera.net>2025-03-13 20:51:12 -0300
commit190e958d17b9cf3704c61e73994ba9e6aac95205 (patch)
treea1d72ab1d2af49c8a6925e993289f948bb515781 /test
parent9cb99b9de5d106239c40dede1ada2cbe7b808eb9 (diff)
parentd4e36a2df66868b921c49d1545f9f096b64459e1 (diff)
Merge branch 'release'
Diffstat (limited to 'test')
-rwxr-xr-xtest/T312-emacs-hl-line.sh160
1 files changed, 160 insertions, 0 deletions
diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
new file mode 100755
index 00000000..3402811c
--- /dev/null
+++ b/test/T312-emacs-hl-line.sh
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+test_description="emacs hl-line-mode"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
+
+test_require_emacs
+add_email_corpus
+
+test_begin_subtest "line 1, search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-search "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (let ((start (overlay-start hl-line-overlay))
+ (end (overlay-end hl-line-overlay)))
+ (list start (> end start)))
+ (list 1 t)))'
+
+test_begin_subtest "line 1, tree"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (let ((start (overlay-start hl-line-overlay))
+ (end (overlay-end hl-line-overlay)))
+ (list start (> end start)))
+ (list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (let ((start (overlay-start hl-line-overlay))
+ (end (overlay-end hl-line-overlay)))
+ (list start (> end start)))
+ (list 1 t)))'
+
+test_begin_subtest "line 1, search, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-search "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal (overlay-start hl-line-overlay) 1))'
+
+test_begin_subtest "line 1, tree, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (let ((start (overlay-start hl-line-overlay))
+ (end (overlay-end hl-line-overlay)))
+ (list start (> end start)))
+ (list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (let ((start (overlay-start hl-line-overlay))
+ (end (overlay-end hl-line-overlay)))
+ (list start (> end start)))
+ (list 1 t)))'
+
+
+test_begin_subtest "line 12, notmuch-search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-search "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, tree"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, unthreaded"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-unthreaded "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, search, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-search "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, tree, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, unthreaded, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (forward-line 11)
+ (notmuch-post-command)
+ (notmuch-refresh-this-buffer)
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "hl-line disabled, search"
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+ (notmuch-search "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (or hl-line-mode hl-line-overlay)
+ nil))'
+
+test_begin_subtest "hl-line disabled, tree"
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+ (notmuch-tree "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (or hl-line-mode hl-line-overlay)
+ nil))'
+
+test_begin_subtest "hl-line disabled, unthreaded"
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+ (notmuch-unthreaded "tag:inbox")
+ (notmuch-test-wait)
+ (notmuch-test-expect-equal
+ (or hl-line-mode hl-line-overlay)
+ nil))'
+
+test_done
+