3 test_description="emacs tree view interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
6 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-tree.expected-output
11 test_begin_subtest "Basic notmuch-tree view in emacs"
12 test_emacs '(notmuch-tree "tag:inbox")
15 (delete-other-windows)'
16 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
18 test_begin_subtest "Refreshed notmuch-tree view in emacs"
19 test_emacs '(notmuch-tree "tag:inbox")
21 (notmuch-tree-refresh-view)
24 (delete-other-windows)'
25 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
27 # In the following tag tests we make sure the display is updated
28 # correctly and, in a separate test, that the database is updated
31 test_begin_subtest "Tag message in notmuch tree view (display)"
32 test_emacs '(notmuch-tree "tag:inbox")
35 (notmuch-tree-tag (list "+test_tag"))
37 (delete-other-windows)'
38 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-tagged OUTPUT
40 test_begin_subtest "Tag message in notmuch tree view (database)"
41 output=$(notmuch search --output=messages 'tag:test_tag')
42 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
44 test_begin_subtest "Untag message in notmuch tree view"
45 test_emacs '(notmuch-tree "tag:inbox")
48 (notmuch-tree-tag (list "-test_tag"))
50 (delete-other-windows)'
51 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
53 test_begin_subtest "Untag message in notmuch tree view (database)"
54 output=$(notmuch search --output=messages 'tag:test_tag')
55 test_expect_equal "$output" ""
57 test_begin_subtest "Tag thread in notmuch tree view"
58 test_emacs '(notmuch-tree "tag:inbox")
60 ;; move to a sizable thread
62 (notmuch-tree-tag-thread (list "+test_thread_tag"))
64 (delete-other-windows)'
65 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-thread-tagged OUTPUT
67 test_begin_subtest "Tag message in notmuch tree view (database)"
68 output=$(notmuch search --output=messages 'tag:test_thread_tag')
69 test_expect_equal "$output" \
70 "id:87ocn0qh6d.fsf@yoom.home.cworth.org
71 id:20091118005040.GA25380@dottiness.seas.harvard.edu
72 id:yunaayketfm.fsf@aiko.keithp.com
73 id:87fx8can9z.fsf@vertex.dottedmag
74 id:20091117203301.GV3165@dottiness.seas.harvard.edu
75 id:87iqd9rn3l.fsf@vertex.dottedmag
76 id:20091117190054.GU3165@dottiness.seas.harvard.edu"
78 test_begin_subtest "Untag thread in notmuch tree view"
79 test_emacs '(notmuch-tree "tag:inbox")
81 ;; move to the same sizable thread as above
83 (notmuch-tree-tag-thread (list "-test_thread_tag"))
85 (delete-other-windows)'
86 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
88 test_begin_subtest "Untag message in notmuch tree view (database)"
89 output=$(notmuch search --output=messages 'tag:test_thread_tag')
90 test_expect_equal "$output" ""
92 test_begin_subtest "Navigation of notmuch-hello to search results"
93 test_emacs '(notmuch-hello)
94 (goto-char (point-min))
95 (re-search-forward "inbox")
96 (widget-button-press (1- (point)))
98 (notmuch-tree-from-search-current-query)
101 (delete-other-windows)'
102 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
104 test_begin_subtest "Tree view of a single thread (from search)"
105 test_emacs '(notmuch-hello)
106 (goto-char (point-min))
107 (re-search-forward "inbox")
108 (widget-button-press (1- (point)))
110 (notmuch-tree-from-search-thread)
113 (delete-other-windows)'
114 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
116 test_begin_subtest "Tree view of a single thread (from show)"
117 test_emacs '(notmuch-hello)
118 (goto-char (point-min))
119 (re-search-forward "inbox")
120 (widget-button-press (1- (point)))
122 (notmuch-search-show-thread)
123 (notmuch-tree-from-show-current-query)
126 (delete-other-windows)'
127 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
129 test_begin_subtest "Message window of tree view"
130 test_emacs '(notmuch-hello)
131 (goto-char (point-min))
132 (re-search-forward "inbox")
133 (widget-button-press (1- (point)))
135 (notmuch-search-next-thread)
136 (notmuch-tree-from-search-thread)
138 (select-window notmuch-tree-message-window)
140 (delete-other-windows)'
141 test_expect_equal_file $EXPECTED/notmuch-tree-show-window OUTPUT
143 test_begin_subtest "Stash id"
144 output=$(test_emacs '(notmuch-tree "id:1258498485-sup-142@elly")
146 (notmuch-show-stash-message-id)')
147 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
149 test_begin_subtest "Move to next matching message"
150 output=$(test_emacs '(notmuch-tree "from:cworth")
152 (notmuch-tree-next-matching-message)
153 (notmuch-show-stash-message-id)')
154 test_expect_equal "$output" "\"Stashed: id:878we4qdqf.fsf@yoom.home.cworth.org\""
156 test_begin_subtest "Move to next thread"
157 output=$(test_emacs '(notmuch-tree "tag:inbox")
160 (notmuch-tree-next-thread)
161 (notmuch-show-stash-message-id)')
162 test_expect_equal "$output" "\"Stashed: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\""
164 test_begin_subtest "Move to previous thread"
165 output=$(test_emacs '(notmuch-tree "tag:inbox")
168 (notmuch-tree-prev-thread)
169 (notmuch-show-stash-message-id)')
170 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
172 test_begin_subtest "Move to previous previous thread"
173 output=$(test_emacs '(notmuch-tree "tag:inbox")
176 (notmuch-tree-prev-thread)
177 (notmuch-tree-prev-thread)
178 (notmuch-show-stash-message-id)')
179 test_expect_equal "$output" "\"Stashed: id:1258493565-13508-1-git-send-email-keithp@keithp.com\""