3 a184c764 2023-04-22 thomas # Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
5 a184c764 2023-04-22 thomas # Permission to use, copy, modify, and distribute this software for any
6 a184c764 2023-04-22 thomas # purpose with or without fee is hereby granted, provided that the above
7 a184c764 2023-04-22 thomas # copyright notice and this permission notice appear in all copies.
9 a184c764 2023-04-22 thomas # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 a184c764 2023-04-22 thomas # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 a184c764 2023-04-22 thomas # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 a184c764 2023-04-22 thomas # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 a184c764 2023-04-22 thomas # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 a184c764 2023-04-22 thomas # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 a184c764 2023-04-22 thomas # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 a184c764 2023-04-22 thomas . ./common.sh
19 a184c764 2023-04-22 thomas test_tree_basic()
21 a184c764 2023-04-22 thomas test_init tree_basic 48 8
23 a184c764 2023-04-22 thomas local head_id=`git_show_head $testroot/repo`
25 a184c764 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
26 a184c764 2023-04-22 thomas SCREENDUMP
29 a184c764 2023-04-22 thomas cat <<EOF >$testroot/view.expected
30 a184c764 2023-04-22 thomas commit $head_id
40 a184c764 2023-04-22 thomas cd $testroot/repo && tog tree
41 a184c764 2023-04-22 thomas cmp -s $testroot/view.expected $testroot/view
43 a184c764 2023-04-22 thomas if [ $ret -ne 0 ]; then
44 a184c764 2023-04-22 thomas diff -u $testroot/view.expected $testroot/view
45 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
49 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
52 a184c764 2023-04-22 thomas test_tree_vsplit_blame()
54 a184c764 2023-04-22 thomas test_init tree_vsplit_blame 120 8
56 a184c764 2023-04-22 thomas local head_id=`git_show_head $testroot/repo`
57 a184c764 2023-04-22 thomas local head_id_truncated=`trim_obj_id 8 $head_id`
58 a184c764 2023-04-22 thomas local head_id_short=`trim_obj_id 32 $head_id`
60 a184c764 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
62 a184c764 2023-04-22 thomas WAIT_FOR_UI wait for blame to finish
63 a184c764 2023-04-22 thomas SCREENDUMP
66 a184c764 2023-04-22 thomas cat <<EOF >$testroot/view.expected
67 a184c764 2023-04-22 thomas commit $head_id_truncated|commit $head_id
68 a184c764 2023-04-22 thomas [1/4] / |[1/1] /alpha
69 a184c764 2023-04-22 thomas |$head_id_short alpha
72 a184c764 2023-04-22 thomas epsilon/ |
77 a184c764 2023-04-22 thomas cd $testroot/repo && tog tree
78 a184c764 2023-04-22 thomas cmp -s $testroot/view.expected $testroot/view
80 a184c764 2023-04-22 thomas if [ $ret -ne 0 ]; then
81 a184c764 2023-04-22 thomas diff -u $testroot/view.expected $testroot/view
82 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
86 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
89 a184c764 2023-04-22 thomas test_tree_hsplit_blame()
91 a184c764 2023-04-22 thomas test_init tree_hsplit_blame 48 24
93 a184c764 2023-04-22 thomas local head_id=`git_show_head $testroot/repo`
94 a184c764 2023-04-22 thomas local head_id_truncated=`trim_obj_id 8 $head_id`
95 a184c764 2023-04-22 thomas local head_id_short=`trim_obj_id 32 $head_id`
97 a184c764 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
100 a184c764 2023-04-22 thomas S toggle horizontal split
101 a184c764 2023-04-22 thomas 4- 4x decrease blame split
102 a184c764 2023-04-22 thomas WAIT_FOR_UI wait for blame to finish
103 a184c764 2023-04-22 thomas SCREENDUMP
106 a184c764 2023-04-22 thomas cat <<EOF >$testroot/view.expected
107 a184c764 2023-04-22 thomas commit $head_id
117 a184c764 2023-04-22 thomas ------------------------------------------------
118 a184c764 2023-04-22 thomas commit $head_id
119 a184c764 2023-04-22 thomas [1/1] /beta
120 a184c764 2023-04-22 thomas $head_id_short beta
133 a184c764 2023-04-22 thomas cd $testroot/repo && tog tree
134 a184c764 2023-04-22 thomas cmp -s $testroot/view.expected $testroot/view
136 a184c764 2023-04-22 thomas if [ $ret -ne 0 ]; then
137 a184c764 2023-04-22 thomas diff -u $testroot/view.expected $testroot/view
138 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
142 a184c764 2023-04-22 thomas test_done "$testroot" "$ret"
145 a184c764 2023-04-22 thomas test_parseargs "$@"
146 a184c764 2023-04-22 thomas run_test test_tree_basic
147 a184c764 2023-04-22 thomas run_test test_tree_vsplit_blame
148 a184c764 2023-04-22 thomas run_test test_tree_hsplit_blame