view src/testdir/test_display.vim @ 10930:126405b39964 v8.0.0354

patch 8.0.0354: test to check that setting termcap key fails sometimes commit https://github.com/vim/vim/commit/1c410400fad79068b16dc4c6c7a023463a0858cf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 23 15:20:03 2017 +0100 patch 8.0.0354: test to check that setting termcap key fails sometimes Problem: Test to check that setting termcap key fails sometimes. Solution: Check for "t_k1" to exist. (Christian Brabandt, closes https://github.com/vim/vim/issues/1459)
author Christian Brabandt <cb@256bit.org>
date Thu, 23 Feb 2017 15:30:05 +0100
parents 232a0d1d8f24
children b25895ab67be
line wrap: on
line source

" Test for displaying stuff
if !has('gui_running') && has('unix')
  set term=ansi
endif

function! s:screenline(lnum, nr) abort
  let line = []
  for j in range(a:nr)
    for c in range(1, winwidth(0))
        call add(line, nr2char(screenchar(a:lnum+j, c)))
    endfor
    call add(line, "\n")
  endfor
  return join(line, '')
endfunction

function! Test_display_foldcolumn()
  new
  vnew
  vert resize 25
  call assert_equal(25, winwidth(winnr()))
  set isprint=@

  1put='e more noise blah blah‚ more stuff here'

  let expect = "e more noise blah blah<82\n> more stuff here        \n"

  call cursor(2, 1)
  norm! zt
  redraw!
  call assert_equal(expect, s:screenline(1,2))
  set fdc=2
  redraw!
  let expect = "  e more noise blah blah<\n  82> more stuff here    \n"
  call assert_equal(expect, s:screenline(1,2))

  quit!
  quit!
endfunction