]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-pick/test/emacs-pick
contrib: pick: test: tag/untag single message
[notmuch] / contrib / notmuch-pick / test / emacs-pick
1 #!/usr/bin/env bash
2
3 test_description="emacs pick interface"
4 . test-lib.sh
5
6 EXPECTED=$TEST_DIRECTORY/pick.expected-output
7
8 add_email_corpus
9 test_begin_subtest "Do we have emacs"
10 test_emacs '(insert "hello\n")
11             (test-output)'
12 cat <<EOF >EXPECTED
13 hello
14 EOF
15 test_expect_equal_file OUTPUT EXPECTED
16
17 test_begin_subtest "Basic notmuch-pick view in emacs"
18 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
19             (require (quote notmuch-pick))
20             (notmuch-pick "tag:inbox")
21             (notmuch-test-wait)
22             (test-output)
23             (delete-other-windows)'
24 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
25
26 test_begin_subtest "Refreshed notmuch-pick view in emacs"
27 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
28             (require (quote notmuch-pick))
29             (notmuch-pick "tag:inbox")
30             (notmuch-test-wait)
31             (notmuch-pick-refresh-view)
32             (notmuch-test-wait)
33             (test-output)
34             (delete-other-windows)'
35 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
36
37 # In the following tag tests we make sure the display is updated
38 # correctly and, in a separate test, that the database is updated
39 # correctly.
40
41 test_begin_subtest "Tag message in notmuch pick view (display)"
42 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
43             (require (quote notmuch-pick))
44             (notmuch-pick "tag:inbox")
45             (notmuch-test-wait)
46             (forward-line)
47             (notmuch-pick-tag "+test_tag")
48             (test-output)
49             (delete-other-windows)'
50 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox-tagged
51
52 test_begin_subtest "Tag message in notmuch pick view (database)"
53 output=$(notmuch search --output=messages 'tag:test_tag')
54 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
55
56 test_begin_subtest "Untag message in notmuch pick view"
57 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
58             (require (quote notmuch-pick))
59             (notmuch-pick "tag:inbox")
60             (notmuch-test-wait)
61             (forward-line)
62             (notmuch-pick-tag "-test_tag")
63             (test-output)
64             (delete-other-windows)'
65 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
66
67 test_begin_subtest "Untag message in notmuch pick view (database)"
68 output=$(notmuch search --output=messages 'tag:test_tag')
69 test_expect_equal "$output" ""
70
71 test_begin_subtest "Navigation of notmuch-hello to search results"
72 test_emacs '(notmuch-hello)
73             (goto-char (point-min))
74             (re-search-forward "inbox")
75             (widget-button-press (1- (point)))
76             (notmuch-test-wait)
77             (notmuch-pick-from-search-current-query)
78             (notmuch-test-wait)
79             (test-output)
80             (delete-other-windows)'
81 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
82
83 test_begin_subtest "Pick of a single thread (from search)"
84 test_emacs '(notmuch-hello)
85             (goto-char (point-min))
86             (re-search-forward "inbox")
87             (widget-button-press (1- (point)))
88             (notmuch-test-wait)
89             (notmuch-pick-from-search-thread)
90             (notmuch-test-wait)
91             (test-output)
92             (delete-other-windows)'
93 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
94
95 test_begin_subtest "Pick of a single thread (from show)"
96 test_emacs '(notmuch-hello)
97             (goto-char (point-min))
98             (re-search-forward "inbox")
99             (widget-button-press (1- (point)))
100             (notmuch-test-wait)
101             (notmuch-search-show-thread)
102             (notmuch-pick-from-show-current-query)
103             (notmuch-test-wait)
104             (test-output)
105             (delete-other-windows)'
106 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
107
108 test_begin_subtest "Message window of pick"
109 test_emacs '(notmuch-hello)
110             (goto-char (point-min))
111             (re-search-forward "inbox")
112             (widget-button-press (1- (point)))
113             (notmuch-test-wait)
114             (notmuch-search-next-thread)
115             (notmuch-pick-from-search-thread)
116             (notmuch-test-wait)
117             (select-window notmuch-pick-message-window)
118             (test-output)
119             (delete-other-windows)'
120 cp OUTPUT /tmp/mjwout
121 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-show-window
122
123 test_done