diff 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
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_conceal.vim
@@ -0,0 +1,97 @@
+" Tests for 'conceal'.
+" Also see test88.in (should be converted to a test function here).
+
+if !has('conceal')
+  finish
+endif
+
+source screendump.vim
+if !CanRunVimInTerminal()
+  finish
+endif
+
+func Test_conceal_two_windows()
+  call writefile([
+	\ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]',
+	\ 'call setline(1, lines)',
+	\ 'syntax match test /|hidden|/ conceal',
+	\ 'set conceallevel=2',
+	\ 'set concealcursor=',
+	\ 'exe "normal /here\r"',
+	\ 'new',
+	\ 'call setline(1, lines)',
+	\ 'call setline(4, "Second window")',
+	\ 'syntax match test /|hidden|/ conceal',
+	\ 'set conceallevel=2',
+	\ 'set concealcursor=nc',
+	\ 'exe "normal /here\r"',
+	\ ], 'XTest_conceal')
+  " Check that cursor line is concealed
+  let buf = RunVimInTerminal('-S XTest_conceal', {})
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
+
+  " Check that with concealed text vertical cursor movement is correct.
+  call term_sendkeys(buf, "k")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_02', {})
+
+  " Check that with cursor line is not concealed
+  call term_sendkeys(buf, "j")
+  call term_sendkeys(buf, ":set concealcursor=\r")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_03', {})
+
+  " Check that with cursor line is not concealed when moving cursor down
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_04', {})
+
+  " Check that with cursor line is not concealed when switching windows
+  call term_sendkeys(buf, "\<C-W>\<C-W>")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_05', {})
+
+  " Check that with cursor line is only concealed in Normal mode
+  call term_sendkeys(buf, ":set concealcursor=n\r")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_06n', {})
+  call term_sendkeys(buf, "a")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_06i', {})
+  call term_sendkeys(buf, "\<Esc>/e")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_06c', {})
+  call term_sendkeys(buf, "\<Esc>v")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_06v', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " Check that with cursor line is only concealed in Insert mode
+  call term_sendkeys(buf, ":set concealcursor=i\r")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_07n', {})
+  call term_sendkeys(buf, "a")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_07i', {})
+  call term_sendkeys(buf, "\<Esc>/e")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_07c', {})
+  call term_sendkeys(buf, "\<Esc>v")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_07v', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " Check that with cursor line is only concealed in Command mode
+  call term_sendkeys(buf, ":set concealcursor=c\r")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_08n', {})
+  call term_sendkeys(buf, "a")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_08i', {})
+  call term_sendkeys(buf, "\<Esc>/e")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_08c', {})
+  call term_sendkeys(buf, "\<Esc>v")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_08v', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " Check that with cursor line is only concealed in Visual mode
+  call term_sendkeys(buf, ":set concealcursor=v\r")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_09n', {})
+  call term_sendkeys(buf, "a")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_09i', {})
+  call term_sendkeys(buf, "\<Esc>/e")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_09c', {})
+  call term_sendkeys(buf, "\<Esc>v")
+  call VerifyScreenDump(buf, 'Test_conceal_two_windows_09v', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XTest_conceal')
+endfunc