aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/107_adjust_window_and_contents_spec.lua
blob: 610bac7f2137b6008a91eabb8c0e3bff6069a259 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-- Tests for adjusting window and contents

local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local insert = helpers.insert
local clear, execute = helpers.clear, helpers.execute

if helpers.pending_win32(pending) then return end

describe('107', function()
  setup(clear)

  it('is working', function()
    local screen = Screen.new()
    screen:attach()

    insert('start:')
    execute('new')
    execute('call setline(1, range(1,256))')
    execute('let r=[]')
    execute('func! GetScreenStr(row)')
    execute('   let str = ""')
    execute('   for c in range(1,3)')
    execute('       let str .= nr2char(screenchar(a:row, c))')
    execute('   endfor')
    execute('   return str')
    execute('endfunc')
    execute([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
    execute('let s3=GetScreenStr(1)')
    execute('wincmd p')
    execute('call add(r, [line("w0"), s3])')
    execute([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
    execute('let s3=GetScreenStr(1)')
    execute('wincmd p')
    execute('call add(r, [line("w0"), s3])')
    execute([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
    execute('let s3=GetScreenStr(1)')
    execute(':wincmd p')
    execute('call add(r, [line("w0"), s3])')
    execute('bwipeout!')
    execute('$put=r')
    execute('call garbagecollect(1)')

    screen:expect([[
      start:                                               |
      [1, '1  ']                                           |
      [50, '50 ']                                          |
      ^[59, '59 ']                                          |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      ~                                                    |
      :call garbagecollect(1)                              |
    ]])
  end)
end)