blob: e0e3e3b54cca197572c503021dfc334a7ce06abb [file] [log] [blame]
Bram Moolenaar62706602016-12-09 19:28:48 +01001" Test for displaying stuff
2if !has('gui_running') && has('unix')
3 set term=ansi
4endif
5
Bram Moolenaarc6cd8402017-03-29 14:40:47 +02006source view_util.vim
Bram Moolenaar62706602016-12-09 19:28:48 +01007
Bram Moolenaar1e115362019-01-09 23:01:02 +01008func Test_display_foldcolumn()
Bram Moolenaarc6cd8402017-03-29 14:40:47 +02009 if !has("folding")
10 return
11 endif
Bram Moolenaar62706602016-12-09 19:28:48 +010012 new
13 vnew
14 vert resize 25
Bram Moolenaar70892372016-12-09 19:51:49 +010015 call assert_equal(25, winwidth(winnr()))
16 set isprint=@
Bram Moolenaar62706602016-12-09 19:28:48 +010017
18 1put='e more noise blah blah‚ more stuff here'
19
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020020 let expect = [
21 \ "e more noise blah blah<82",
22 \ "> more stuff here "
23 \ ]
Bram Moolenaar62706602016-12-09 19:28:48 +010024
25 call cursor(2, 1)
26 norm! zt
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020027 let lines=ScreenLines([1,2], winwidth(0))
28 call assert_equal(expect, lines)
Bram Moolenaar62706602016-12-09 19:28:48 +010029 set fdc=2
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020030 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)
Bram Moolenaar62706602016-12-09 19:28:48 +010036
37 quit!
38 quit!
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020039endfunc
40
Bram Moolenaar1e115362019-01-09 23:01:02 +010041func Test_display_foldtext_mbyte()
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020042 if !has("folding") || !has("multi_byte")
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)
Bram Moolenaar8da1e6c2017-03-29 20:38:59 +020057
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
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020067 set foldtext& fillchars& foldmethod& fdc&
68 bw!
69endfunc