summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-06 04:50:35 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-06 04:50:35 +0200
commit49e649fc2eb196b2476a3bc2947c7a89e0f69c2f (patch)
tree64955601e26e5749b5d1f3217746d899424778e5 /src/testdir
parent84a05acc8c341c2be383198496764992ae971a46 (diff)
downloadvim-49e649fc2eb196b2476a3bc2947c7a89e0f69c2f.zip
updated for version 7.3.926
Problem: Autocommands are triggered by setwinvar() et al. Missing BufEnter on :tabclose. Duplicate WinEnter on :tabclose. Wrong order of events for :tablose and :tabnew. Solution: Fix these autocommand events. (Zyx)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test62.in62
-rw-r--r--src/testdir/test62.ok68
2 files changed, 130 insertions, 0 deletions
diff --git a/src/testdir/test62.in b/src/testdir/test62.in
index fd1844bdc..933bfe505 100644
--- a/src/testdir/test62.in
+++ b/src/testdir/test62.in
@@ -120,6 +120,68 @@ i=tabpagenr() 
:endtry
i=a 
:"
+:" Test autocommands
+:tabonly!
+:let g:r=[]
+:command -nargs=1 -bar C :call add(g:r, '=== ' . <q-args> . ' ===')|<args>
+:function Test()
+ let hasau=has('autocmd')
+ if hasau
+ autocmd TabEnter * :call add(g:r, 'TabEnter')
+ autocmd WinEnter * :call add(g:r, 'WinEnter')
+ autocmd BufEnter * :call add(g:r, 'BufEnter')
+ autocmd TabLeave * :call add(g:r, 'TabLeave')
+ autocmd WinLeave * :call add(g:r, 'WinLeave')
+ autocmd BufLeave * :call add(g:r, 'BufLeave')
+ endif
+ let t:a='a'
+ C tab split
+ if !hasau
+ let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter']
+ endif
+ let t:a='b'
+ C tabnew
+ if !hasau
+ let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter']
+ endif
+ let t:a='c'
+ call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
+ C call map(range(1, tabpagenr('$')), 'settabvar(v:val, "a", v:val*2)')
+ call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
+ let w:a='a'
+ C vsplit
+ if !hasau
+ let g:r+=['WinLeave', 'WinEnter']
+ endif
+ let w:a='a'
+ let tabn=tabpagenr()
+ let winr=range(1, winnr('$'))
+ C tabnext 1
+ if !hasau
+ let g:r+=['BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter']
+ endif
+ call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
+ C call map(copy(winr), 'settabwinvar('.tabn.', v:val, "a", v:val*2)')
+ call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
+ if hasau
+ augroup TabDestructive
+ autocmd TabEnter * :C tabnext 2 | C tabclose 3
+ augroup END
+ C tabnext 3
+ let g:r+=[tabpagenr().'/'.tabpagenr('$')]
+ autocmd! TabDestructive TabEnter
+ C tabnew
+ C tabnext 1
+ autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3
+ C tabnext 3
+ let g:r+=[tabpagenr().'/'.tabpagenr('$')]
+ else
+ let g:r+=["=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","2/2","=== tabnew ===","WinLeave","TabLeave","WinEnter","TabEnter","BufLeave","BufEnter","=== tabnext 1 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","BufEnter","=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","BufEnter","=== tabclose 3 ===","2/2",]
+ endif
+endfunction
+:call Test()
+:$ put =g:r
+:"
:"
:/^Results/,$w! test.out
:qa!
diff --git a/src/testdir/test62.ok b/src/testdir/test62.ok
index 0ac1fcbbd..df1035ecc 100644
--- a/src/testdir/test62.ok
+++ b/src/testdir/test62.ok
@@ -18,3 +18,71 @@ tab drop 3: pass
4
6
E474 caught.
+=== tab split ===
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+=== tabnew ===
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+BufLeave
+BufEnter
+a b c
+=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ===
+a b c
+=== vsplit ===
+WinLeave
+WinEnter
+=== tabnext 1 ===
+BufLeave
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+BufEnter
+a a
+=== call map(copy(winr), 'settabwinvar('.tabn.', v:val, ===
+a a
+=== tabnext 3 ===
+BufLeave
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+=== tabnext 2 ===
+=== tabclose 3 ===
+2/2
+=== tabnew ===
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+BufLeave
+BufEnter
+=== tabnext 1 ===
+BufLeave
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+BufEnter
+=== tabnext 3 ===
+BufLeave
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+=== tabnext 2 ===
+BufLeave
+WinLeave
+TabLeave
+WinEnter
+TabEnter
+=== tabnext 2 ===
+=== tabclose 3 ===
+BufEnter
+=== tabclose 3 ===
+2/2