comparison src/testdir/test_conceal.vim @ 15426:8b78878311e0 v8.1.0721

patch 8.1.0721: conceal mode is not sufficiently tested commit https://github.com/vim/vim/commit/429ab1761ea9123777c9540ddb35ffa497a7e349 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 11 15:54:45 2019 +0100 patch 8.1.0721: conceal mode is not sufficiently tested Problem: Conceal mode is not sufficiently tested. Solution: Add screendump tests. Check all 'concealcursor' values.
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Jan 2019 16:00:08 +0100
parents
children 80e79573dd6e
comparison
equal deleted inserted replaced
15425:f96431b33513 15426:8b78878311e0
1 " Tests for 'conceal'.
2 " Also see test88.in (should be converted to a test function here).
3
4 if !has('conceal')
5 finish
6 endif
7
8 source screendump.vim
9 if !CanRunVimInTerminal()
10 finish
11 endif
12
13 func Test_conceal_two_windows()
14 call writefile([
15 \ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]',
16 \ 'call setline(1, lines)',
17 \ 'syntax match test /|hidden|/ conceal',
18 \ 'set conceallevel=2',
19 \ 'set concealcursor=',
20 \ 'exe "normal /here\r"',
21 \ 'new',
22 \ 'call setline(1, lines)',
23 \ 'call setline(4, "Second window")',
24 \ 'syntax match test /|hidden|/ conceal',
25 \ 'set conceallevel=2',
26 \ 'set concealcursor=nc',
27 \ 'exe "normal /here\r"',
28 \ ], 'XTest_conceal')
29 " Check that cursor line is concealed
30 let buf = RunVimInTerminal('-S XTest_conceal', {})
31 call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
32
33 " Check that with concealed text vertical cursor movement is correct.
34 call term_sendkeys(buf, "k")
35 call VerifyScreenDump(buf, 'Test_conceal_two_windows_02', {})
36
37 " Check that with cursor line is not concealed
38 call term_sendkeys(buf, "j")
39 call term_sendkeys(buf, ":set concealcursor=\r")
40 call VerifyScreenDump(buf, 'Test_conceal_two_windows_03', {})
41
42 " Check that with cursor line is not concealed when moving cursor down
43 call term_sendkeys(buf, "j")
44 call VerifyScreenDump(buf, 'Test_conceal_two_windows_04', {})
45
46 " Check that with cursor line is not concealed when switching windows
47 call term_sendkeys(buf, "\<C-W>\<C-W>")
48 call VerifyScreenDump(buf, 'Test_conceal_two_windows_05', {})
49
50 " Check that with cursor line is only concealed in Normal mode
51 call term_sendkeys(buf, ":set concealcursor=n\r")
52 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06n', {})
53 call term_sendkeys(buf, "a")
54 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06i', {})
55 call term_sendkeys(buf, "\<Esc>/e")
56 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06c', {})
57 call term_sendkeys(buf, "\<Esc>v")
58 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06v', {})
59 call term_sendkeys(buf, "\<Esc>")
60
61 " Check that with cursor line is only concealed in Insert mode
62 call term_sendkeys(buf, ":set concealcursor=i\r")
63 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07n', {})
64 call term_sendkeys(buf, "a")
65 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07i', {})
66 call term_sendkeys(buf, "\<Esc>/e")
67 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07c', {})
68 call term_sendkeys(buf, "\<Esc>v")
69 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07v', {})
70 call term_sendkeys(buf, "\<Esc>")
71
72 " Check that with cursor line is only concealed in Command mode
73 call term_sendkeys(buf, ":set concealcursor=c\r")
74 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08n', {})
75 call term_sendkeys(buf, "a")
76 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08i', {})
77 call term_sendkeys(buf, "\<Esc>/e")
78 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08c', {})
79 call term_sendkeys(buf, "\<Esc>v")
80 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08v', {})
81 call term_sendkeys(buf, "\<Esc>")
82
83 " Check that with cursor line is only concealed in Visual mode
84 call term_sendkeys(buf, ":set concealcursor=v\r")
85 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09n', {})
86 call term_sendkeys(buf, "a")
87 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09i', {})
88 call term_sendkeys(buf, "\<Esc>/e")
89 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09c', {})
90 call term_sendkeys(buf, "\<Esc>v")
91 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09v', {})
92 call term_sendkeys(buf, "\<Esc>")
93
94 " clean up
95 call StopVimInTerminal(buf)
96 call delete('XTest_conceal')
97 endfunc