multigrid: test refactor

This commit is contained in:
Björn Linse
2018-11-17 18:23:42 +01:00
parent 13f74635fa
commit ed3da23cf4
2 changed files with 359 additions and 269 deletions

View File

@@ -44,18 +44,18 @@ describe('multigrid screen', function()
it('default initial screen', function()
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -78,18 +78,18 @@ describe('multigrid screen', function()
command('vsplit')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
@@ -128,18 +128,18 @@ describe('multigrid screen', function()
command('split')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│}{11:[No Name] }|
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}{11:[No Name] }|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [No Name] }|
|
## grid 2
@@ -179,18 +179,18 @@ describe('multigrid screen', function()
command('q')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] }|
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -220,18 +220,18 @@ describe('multigrid screen', function()
command('sp')
screen:expect([[
## grid 1
|
|
|
|
|
|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] }|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -253,21 +253,20 @@ describe('multigrid screen', function()
it('resizes grids', function ()
command('sp')
command('resize 8')
-- see "Note 1" for info about why there are three statuslines
screen:expect([[
## grid 1
|
|
|
|
|
|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] }|
|
{11:[No Name] }|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -292,18 +291,18 @@ describe('multigrid screen', function()
command('vsp')
screen:expect([[
## grid 1
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
{11:[No Name] }{12:[No Name] [No Name] }|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -337,18 +336,18 @@ describe('multigrid screen', function()
insert('hello')
screen:expect([[
## grid 1
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
{11:[No Name] [+] }{12:[No Name] [+] [No Name] [+] }|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
@@ -382,21 +381,51 @@ describe('multigrid screen', function()
end)
it('closes splits', function ()
command('sp')
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('q')
screen:expect([[
## grid 1
|
|
|
|
|
|
{11:[No Name] }|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -421,18 +450,18 @@ describe('multigrid screen', function()
command('vsp')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
@@ -469,18 +498,18 @@ describe('multigrid screen', function()
-- see "Note 1" for info about why there are two vseps
screen:expect([[
## grid 1
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
{12:│} {12:│} |
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
{11:<No Name] }{12:[No Name] }|
|
## grid 2
@@ -516,18 +545,18 @@ describe('multigrid screen', function()
command('sp')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{11:[No Name] }{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [No Name] }|
|
## grid 2
@@ -560,18 +589,18 @@ describe('multigrid screen', function()
insert('hello')
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{11:[No Name] [+] }{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] [+] }{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [+] [No Name] [+] }|
|
## grid 2
@@ -600,26 +629,68 @@ describe('multigrid screen', function()
{1:~ }|
{1:~ }|
{1:~ }|
]])
]])
end)
it('closes splits', function ()
command('vsp')
command('q')
-- see "Note 1" for info about why there is a vsep
screen:expect([[
## grid 1
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
{12:│} |
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('q')
screen:expect([[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -645,10 +716,10 @@ describe('multigrid screen', function()
screen:try_resize(25, 6)
screen:expect([[
## grid 1
|
|
|
|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -663,7 +734,7 @@ describe('multigrid screen', function()
screen:try_resize(1, 1)
screen:expect([[
## grid 1
|
[2:------------]|
{11:[No Name] }|
|
## grid 2
@@ -673,7 +744,7 @@ describe('multigrid screen', function()
feed('<esc>:ls')
screen:expect([[
## grid 1
|
[2:------------]|
{11:[No Name] }|
:ls^ |
## grid 2
@@ -687,18 +758,18 @@ describe('multigrid screen', function()
screen:try_resize_grid(2, 8, 5)
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -716,18 +787,18 @@ describe('multigrid screen', function()
screen:try_resize_grid(2, 80, 20)
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -763,18 +834,18 @@ describe('multigrid screen', function()
insert(('a'):rep(60).."\n")
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
@@ -805,18 +876,18 @@ describe('multigrid screen', function()
insert(('b'):rep(80).."\n")
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
@@ -848,18 +919,18 @@ describe('multigrid screen', function()
' long message"')
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] }|
this is a very very very...ry very very long message |
## grid 2
@@ -891,18 +962,18 @@ describe('multigrid screen', function()
feed('kzfgg')
screen:expect([[
## grid 1
|
|
|
|
|
|
|
|
|
|
|
|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2