annotate src/testdir/test_window_id.vim @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Oct 2019 04:30:05 +0100
parents 11dca9732a48
children 068337e86133
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test using the window ID.
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_win_getid()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 edit one
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 let id1 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
6 let w:one = 'one'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 split two
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let id2 = win_getid()
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
9 let bufnr2 = bufnr('%')
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
10 let w:two = 'two'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 split three
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let id3 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
13 let w:three = 'three'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 tabnew
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 edit four
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let id4 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
17 let w:four = 'four'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 split five
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 let id5 = win_getid()
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
20 let bufnr5 = bufnr('%')
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
21 let w:five = 'five'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal("two", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal(id2, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let nr2 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal("one", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal(id1, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let nr1 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal("three", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal(id3, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let nr3 = winnr()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
36 call assert_equal('one', getwinvar(id1, 'one'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
37 call assert_equal('two', getwinvar(id2, 'two'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
38 call assert_equal('three', getwinvar(id3, 'three'))
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal("five", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal(id5, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let nr5 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal("four", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(id4, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let nr4 = winnr()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
47 call assert_equal('four', getwinvar(id4, 'four'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
48 call assert_equal('five', getwinvar(id5, 'five'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
49 call settabwinvar(1, id2, 'two', '2')
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
50 call setwinvar(id4, 'four', '4')
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 tabnext
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
52 call assert_equal('4', gettabwinvar(2, id4, 'four'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
53 call assert_equal('five', gettabwinvar(2, id5, 'five'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
54 call assert_equal('2', getwinvar(id2, 'two'))
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 exe nr1 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal(id1, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 exe nr2 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_equal(id2, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 exe nr3 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call assert_equal(id3, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 exe nr4 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call assert_equal(id4, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 exe nr5 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call assert_equal(id5, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call win_gotoid(id2)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call assert_equal("two", expand("%"))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
70 eval id4->win_gotoid()
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call assert_equal("four", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call win_gotoid(id1)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal("one", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call win_gotoid(id5)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal("five", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(0, win_id2win(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
78 call assert_equal(nr5, id5->win_id2win())
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(0, win_id2win(id1))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal(nr1, win_id2win(id1))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal([0, 0], win_id2tabwin(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
84 call assert_equal([1, nr2], id2->win_id2tabwin())
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal([2, nr4], win_id2tabwin(id4))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
87 call assert_equal([], win_findbuf(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
88 call assert_equal([id2], bufnr2->win_findbuf())
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
89 call win_gotoid(id5)
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
90 split
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
91 call assert_equal(sort([id5, win_getid()]), sort(win_findbuf(bufnr5)))
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
92
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 only!
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 endfunc
10377
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
95
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
96 func Test_win_getid_curtab()
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
97 tabedit X
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
98 tabfirst
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
99 copen
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
100 only
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
101 call assert_equal(win_getid(1), 1->win_getid( 1))
10377
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
102 tabclose!
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
103 endfunc
14587
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
104
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
105 func Test_winlayout()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
106 let w1 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
107 call assert_equal(['leaf', w1], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
108
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
109 split
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
110 let w2 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
111 call assert_equal(['col', [['leaf', w2], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
112
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
113 split
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
114 let w3 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
115 call assert_equal(['col', [['leaf', w3], ['leaf', w2], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
116
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
117 2wincmd w
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
118 vsplit
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
119 let w4 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
120 call assert_equal(['col', [['leaf', w3], ['row', [['leaf', w4], ['leaf', w2]]], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
121
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
122 only!
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
123
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
124 let w1 = win_getid()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
125 call assert_equal(['leaf', w1], winlayout(1))
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
126 tabnew
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
127 let w2 = win_getid()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
128 call assert_equal(['leaf', w2], 2->winlayout())
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
129 tabclose
14587
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
130 endfunc