xref: /vim-8.2.3635/src/testdir/test_display.vim (revision 577fadfc)
1" Test for displaying stuff
2if !has('gui_running') && has('unix')
3  set term=ansi
4endif
5
6source view_util.vim
7
8func Test_display_foldcolumn()
9  if !has("folding")
10    return
11  endif
12  new
13  vnew
14  vert resize 25
15  call assert_equal(25, winwidth(winnr()))
16  set isprint=@
17
18  1put='e more noise blah blah‚ more stuff here'
19
20  let expect = [
21        \ "e more noise blah blah<82",
22        \ "> more stuff here        "
23        \ ]
24
25  call cursor(2, 1)
26  norm! zt
27  let lines=ScreenLines([1,2], winwidth(0))
28  call assert_equal(expect, lines)
29  set fdc=2
30  let lines=ScreenLines([1,2], winwidth(0))
31  let expect = [
32        \ "  e more noise blah blah<",
33        \ "  82> more stuff here    "
34        \ ]
35  call assert_equal(expect, lines)
36
37  quit!
38  quit!
39endfunc
40
41func Test_display_foldtext_mbyte()
42  if !has("folding")
43    return
44  endif
45  call NewWindow(10, 40)
46  call append(0, range(1,20))
47  exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2"
48  call cursor(2, 1)
49  norm! zf13G
50  let lines=ScreenLines([1,3], winwidth(0)+1)
51  let expect=[
52        \ "  1                                     \u2502",
53        \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502",
54        \ "  14                                    \u2502",
55        \ ]
56  call assert_equal(expect, lines)
57
58  set fillchars=fold:-,vert:\|
59  let lines=ScreenLines([1,3], winwidth(0)+1)
60  let expect=[
61        \ "  1                                     |",
62        \ "+ +-- 12 lines: 2". repeat("-", 23). "|",
63        \ "  14                                    |",
64        \ ]
65  call assert_equal(expect, lines)
66
67  set foldtext& fillchars& foldmethod& fdc&
68  bw!
69endfunc
70