3 test_description="emacs tree view interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
6 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-tree.expected-output
10 test_begin_subtest "Basic notmuch-tree view in emacs"
11 test_emacs '(notmuch-tree "tag:inbox")
14 (delete-other-windows)'
15 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
17 test_begin_subtest "Refreshed notmuch-tree view in emacs"
18 test_emacs '(notmuch-tree "tag:inbox")
20 (notmuch-tree-refresh-view)
23 (delete-other-windows)'
24 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
26 # In the following tag tests we make sure the display is updated
27 # correctly and, in a separate test, that the database is updated
30 test_begin_subtest "Tag message in notmuch tree view (display)"
31 test_emacs '(notmuch-tree "tag:inbox")
34 (notmuch-tree-tag (list "+test_tag"))
36 (delete-other-windows)'
37 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-tagged OUTPUT
39 test_begin_subtest "Tag message in notmuch tree view (database)"
40 output=$(notmuch search --output=messages 'tag:test_tag')
41 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
43 test_begin_subtest "Untag message in notmuch tree view"
44 test_emacs '(notmuch-tree "tag:inbox")
47 (notmuch-tree-tag (list "-test_tag"))
49 (delete-other-windows)'
50 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
52 test_begin_subtest "Untag message in notmuch tree view (database)"
53 output=$(notmuch search --output=messages 'tag:test_tag')
54 test_expect_equal "$output" ""
56 test_begin_subtest "Tag thread in notmuch tree view"
57 test_emacs '(notmuch-tree "tag:inbox")
59 ;; move to a sizable thread
61 (notmuch-tree-tag-thread (list "+test_thread_tag"))
63 (delete-other-windows)'
64 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-thread-tagged OUTPUT
66 test_begin_subtest "Tag message in notmuch tree view (database)"
67 output=$(notmuch search --output=messages 'tag:test_thread_tag')
68 test_expect_equal "$output" \
69 "id:87ocn0qh6d.fsf@yoom.home.cworth.org
70 id:20091118005040.GA25380@dottiness.seas.harvard.edu
71 id:yunaayketfm.fsf@aiko.keithp.com
72 id:87fx8can9z.fsf@vertex.dottedmag
73 id:20091117203301.GV3165@dottiness.seas.harvard.edu
74 id:87iqd9rn3l.fsf@vertex.dottedmag
75 id:20091117190054.GU3165@dottiness.seas.harvard.edu"
77 test_begin_subtest "Untag thread in notmuch tree view"
78 test_emacs '(notmuch-tree "tag:inbox")
80 ;; move to the same sizable thread as above
82 (notmuch-tree-tag-thread (list "-test_thread_tag"))
84 (delete-other-windows)'
85 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
87 test_begin_subtest "Untag message in notmuch tree view (database)"
88 output=$(notmuch search --output=messages 'tag:test_thread_tag')
89 test_expect_equal "$output" ""
91 test_begin_subtest "Navigation of notmuch-hello to search results"
92 test_emacs '(notmuch-hello)
93 (goto-char (point-min))
94 (re-search-forward "inbox")
95 (widget-button-press (1- (point)))
97 (notmuch-tree-from-search-current-query)
100 (delete-other-windows)'
101 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
103 test_begin_subtest "Tree view of a single thread (from search)"
104 test_emacs '(notmuch-hello)
105 (goto-char (point-min))
106 (re-search-forward "inbox")
107 (widget-button-press (1- (point)))
109 (notmuch-tree-from-search-thread)
112 (delete-other-windows)'
113 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
115 test_begin_subtest "Tree view of a single thread (from show)"
116 test_emacs '(notmuch-hello)
117 (goto-char (point-min))
118 (re-search-forward "inbox")
119 (widget-button-press (1- (point)))
121 (notmuch-search-show-thread)
122 (notmuch-tree-from-show-current-query)
125 (delete-other-windows)'
126 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
128 test_begin_subtest "Message window of tree view"
129 test_emacs '(notmuch-hello)
130 (goto-char (point-min))
131 (re-search-forward "inbox")
132 (widget-button-press (1- (point)))
134 (notmuch-search-next-thread)
135 (notmuch-tree-from-search-thread)
137 (select-window notmuch-tree-message-window)
139 (delete-other-windows)'
140 test_expect_equal_file $EXPECTED/notmuch-tree-show-window OUTPUT
142 test_begin_subtest "Stash id"
143 output=$(test_emacs '(notmuch-tree "id:1258498485-sup-142@elly")
145 (notmuch-show-stash-message-id)')
146 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
148 test_begin_subtest "Move to next matching message"
149 output=$(test_emacs '(notmuch-tree "from:cworth")
151 (notmuch-tree-next-matching-message)
152 (notmuch-show-stash-message-id)')
153 test_expect_equal "$output" "\"Stashed: id:878we4qdqf.fsf@yoom.home.cworth.org\""
155 test_begin_subtest "Move to next thread"
156 output=$(test_emacs '(notmuch-tree "tag:inbox")
159 (notmuch-tree-next-thread)
160 (notmuch-show-stash-message-id)')
161 test_expect_equal "$output" "\"Stashed: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\""
163 test_begin_subtest "Move to previous thread"
164 output=$(test_emacs '(notmuch-tree "tag:inbox")
167 (notmuch-tree-prev-thread)
168 (notmuch-show-stash-message-id)')
169 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
171 test_begin_subtest "Move to previous previous thread"
172 output=$(test_emacs '(notmuch-tree "tag:inbox")
175 (notmuch-tree-prev-thread)
176 (notmuch-tree-prev-thread)
177 (notmuch-show-stash-message-id)')
178 test_expect_equal "$output" "\"Stashed: id:1258493565-13508-1-git-send-email-keithp@keithp.com\""